P
Pietro
Hi,
Is there a code to delete all database queries and forms.
Currently I'm using the below codes, but actually the one the deletes the
forms cannot delete the one that currently open,so all the forms are deleted
except one, how can i delete everything?
Code to delete forms:
On Error Resume Next
If Date >= #12/31/2008# Then
DoCmd.Close acForm, "login"
DoCmd.Close acForm, "passme"
Dim db As Database
Dim objform As Object
Set db = CurrentDb
For Each objform In db.Containers("Forms").Documents
DoCmd.DeleteObject acForm, objform.Name
Next
End If
Code to delete queries:
On Error Resume Next
If Date >= #12/31/2008# Then
DoCmd.Close acForm, "login"
DoCmd.Close acForm, "passme"
Dim db As DAO.Database, i
Set db = CurrentDb
For i = 0 To db.QueryDefs.Count - 1
DoCmd.DeleteObject acQuery, db.QueryDefs(i).Name
Next i
End If
Is there a code to delete all database queries and forms.
Currently I'm using the below codes, but actually the one the deletes the
forms cannot delete the one that currently open,so all the forms are deleted
except one, how can i delete everything?
Code to delete forms:
On Error Resume Next
If Date >= #12/31/2008# Then
DoCmd.Close acForm, "login"
DoCmd.Close acForm, "passme"
Dim db As Database
Dim objform As Object
Set db = CurrentDb
For Each objform In db.Containers("Forms").Documents
DoCmd.DeleteObject acForm, objform.Name
Next
End If
Code to delete queries:
On Error Resume Next
If Date >= #12/31/2008# Then
DoCmd.Close acForm, "login"
DoCmd.Close acForm, "passme"
Dim db As DAO.Database, i
Set db = CurrentDb
For i = 0 To db.QueryDefs.Count - 1
DoCmd.DeleteObject acQuery, db.QueryDefs(i).Name
Next i
End If