The code discussed in this thread should provide you with the answer to the first part of your question.
You could test the Current Date against your Dead Line date in the On Load event of your Welcome form. Something along the lines of;
Code:
If Date() > 01/01/2099 Then
[COLOR="Green"]'Run your self destruct code here[/COLOR]
End If
This will run your Self Destruct code the first time the DB is opened after 01/01/2099 (you would of course replace that date with your own deadline date)
Which prompts me to ask a question, that perhaps should have been asked earlier. Why exactly do you wish to delete all tables in your DB after a certain date
Which prompts me to ask a question, that perhaps should have been asked earlier. Why exactly do you wish to delete all tables in your DB after a certain date
Yes Sir, I want to use this database till certain period e.g. 03/15/12, and after this date, when someone try to open the file, its delete the file or corrupt the data.
I used a following VBA code for excel, and tested it works for excel I want same kind of code which works for Access.
Please remeber following code only works for Excel
Private Sub Workbook_Open()
Dim XDate As Date
XDate = #12/31/2012# ' Assign a date.
If Date >= XDate Then
MsgBox "Your File has Expired"
Me.ChangeFileAccess xlReadOnly
Kill Me.FullName
Me.Close False
End If
Reset
End Sub