S
Shane Nation
I am using Access XP and on Open event in a form (FormList) I have placed
the following code:
Private Sub Form_Open(Cancel As Integer)
Dim stDate As Date
Dim stDocName As String
stDate = Now()
If stDate >= "18/07/04" Then
DoCmd.DeleteObject acTable, "LIST"
DoCmd.Close acForm, "FormList"
DoCmd.DeleteObject acForm, "FormList"
Else
End If
End Sub
It is to check if there is an out of date table and if so delete the table
and delete this form, so I can create another one linking it to the new
table.
However it all works fine, but the delete form, I get an error message
saying I can't delete the form while it is open. I guessed it was because
the code was within the form I was trying to delete, so I opened a second
form which had the code to delete the 1st, but I got the same message?
Pleasse can anyone assist?
the following code:
Private Sub Form_Open(Cancel As Integer)
Dim stDate As Date
Dim stDocName As String
stDate = Now()
If stDate >= "18/07/04" Then
DoCmd.DeleteObject acTable, "LIST"
DoCmd.Close acForm, "FormList"
DoCmd.DeleteObject acForm, "FormList"
Else
End If
End Sub
It is to check if there is an out of date table and if so delete the table
and delete this form, so I can create another one linking it to the new
table.
However it all works fine, but the delete form, I get an error message
saying I can't delete the form while it is open. I guessed it was because
the code was within the form I was trying to delete, so I opened a second
form which had the code to delete the 1st, but I got the same message?
Pleasse can anyone assist?