name = "gggg" '给变量赋值软件名为gggg
ReValue = GetSetting(name, "MainKey", "DateValue", Date) '读取注册表软件名gggg的键值,如果没有则为当前日期
Me.Text1 = ReValue
dd = DateDiff("d", ReValue, Date) '计算日期差
Me.Text2 = dd
If dd = 0 Then '如果是第一天运行
SaveSetting name, "MainKey", "dateValue", Date '写注册表
End If
If dd > 30 Then
MsgBox "软件已过期"
Else
MsgBox "软件可以试用"
'DoCmd Quit
MsgBox "还剩下" & 30 - dd & "天试用期!"