以下代码在编译时提示许多属性不存在,大家不妨调试一下,不知为身摸。Private Sub Main()On Error GoTo ERRORIf App.PrevInstance = True ThenMsgBox "本系统已经启动!请查看任务栏!", 48, gthEndEnd If'试用期的程序If Dir("c:\windows\sysbckup\date.mdb") = "" Then Dim WS As Workspace Dim DB As Database Dim TD As TableDef Dim FLD As Field Dim IDX As Index Dim rd As Recordset Set WS = DBEngine.Workspaces(0) Set DB = WS.CreateDatabase("c:\windows\sysbckup\date.mdb", dbLangGeneral) DB.Connect = ";pwd=SPRINGLOVER" Set TD = DB.CreateTableDef("date") TD.Attributes = 0 TD.Connect = "" TD.SourceTableName = "" TD.ValidationRule = "" TD.ValidationText = "" ' Field first_time Set FLD = TD.CreateField("first_time", 8, 8) FLD.Attributes = 1 FLD.DefaultValue = "" FLD.OrdinalPosition = 0 FLD.Required = False FLD.ValidationRule = "" FLD.ValidationText = "" TD.Fields.Append FLD ' Field last_time Set FLD = TD.CreateField("last_time", 8, 8) FLD.Attributes = 1 FLD.DefaultValue = "" FLD.OrdinalPosition = 1 FLD.Required = False FLD.ValidationRule = "" FLD.ValidationText = "" TD.Fields.Append FLD ' Field times Set FLD = TD.CreateField("times", 3, 2) FLD.Attributes = 1 FLD.DefaultValue = "" FLD.OrdinalPosition = 2 FLD.Required = False FLD.ValidationRule = "" FLD.ValidationText = "" TD.Fields.Append FLD DB.TableDefs.Append TD DB.Close Set DB = WS.OpenDatabase("c:\windows\sysbckup\date.mdb") ', pwd = "SPRINGLOVER") Set rd = DB.OpenRecordset("date") With rd .AddNew .Fields("first_time") = Date .Fields("last_time") = Date .Fields("times") = 1 .Update End With DB.Close MsgBox "这是您第一次启动本系统!您的试用期为1000天,今天是第一天.谢谢使用!", 48, "天华电脑艺术创意工作室" mainform.Show '启动您的主窗体Else Dim WS2 As Workspace Dim DB2 As Database Dim rd2 As Recordset Set WS2 = Workspaces(0) Set DB2 = WS2.OpenDatabase("c:\windows\sysbckup\date.mdb", pwd = "SPRINGLOVER") Set rd2 = DB2.OpenRecordset("date") '开始检测用户是否修改了系统日期 If Not (rd2.EOF And rd2.BOF) Then rd2.MoveFirst End If If rd2.Fields("last_time") > Date Then MsgBox "对不起,您在本软件的试用期内不可以修改系统日期,否则将取消您对不系统的试用权.如果您想继续使用本软件,请您恢复系统日期.谢谢合作!", 48, "天华电脑艺术创意工作室" End End If '开始检测是否超期 If Date - rd2.Fields("first_time") >= 1000 Then '设定试用期为1000天 MsgBox "您已经启动本系统" & rd2.Fields("times") & "次了,而且已经到了1000天的试用期,如果您想继续使用本软件,请您到本公司注册并购买正版的软件!", 48, "天华电脑艺术创意工作室" End Else '仍在试用期内 Num% = rd2.Fields("times") rd2.Edit rd2.Fields("last_time") = Date rd2.Fields("times") = Num + 1 rd2.Update MsgBox "这是您第" & rd2.Fields("times") & "次使用本系统,您还有" & 1000 - (Date - rd2.Fields("first_time")) & "天的试用期,祝您今天工作愉快!", 48, "天华电脑艺术创意工作室" mainform.Show '启动您的主窗体 End IfEnd Iffrmback.ShowExit SubERROR:MsgBox "系统错误!启动失败!"End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货