هذا كود ليجعل البرنامج يعمل لفترة زمنية محددة ارجو عمل مثل عليه
Private Sub Form_Open(Cancel As Integer)
On Error GoTo MyErr:
Dim MyFirst As Date
Dim MyInDate
Dim MyTableName As String
MyInDate = DFirst("[Date1]", "[T1]")
If Not IsNull(MyInDate) Then
MyFirst = MyInDate
Else
DoCmd.SetWarnings False
DoCmd.RunSQL ("INSERT INTO T1 ( Date1 ) SELECT Date();")
DoCmd.SetWarnings True
MyFirst = Date
End If
If MyFirst <= Date - 3 Then '[color=green] غير الرقم من 3 الى اي عدد تريد[/color]
MsgBox"مضى على التشغيل 3 ايام وسيتم ايقافه"
Call TableDelete
Else
If MyFirst > Date Then
MsgBox"تم التلاعب بتاريخ الجهاز وسيتم ايقاف تشغيله"
Call TableDelete
End If
End If
Exit Sub
MyErr:
If Err.Number = 3078 Then
MsgBox"تم تعطيل البرنامج"
' Quit
'قمت بتعطيل الامر خروج لتروا الطريقة
Else
MsgBox Err.Number & vbCrLf & Err.Description
End If
End Sub
Function TableDelete()
On Error Resume Next
Dim MyDb As Database
Dim MyTable As TableDef
Dim MyTableCount As Integer
Set MyDb = Application.CurrentDb
MyTableCount = MyDb.TableDefs.Count
For i = MyTableCount - 1 To o Step -1
Set MyTable = MyDb.TableDefs(i)
MyTableName = MyTable.Name
If Left$(MyTableName, 4) <> "Msys" Then MyDb.TableDefs.Delete (MyTableName)
Next
MyDb.Close
End Function