D
Duck
I am trying to delete all the old queries from my database from the
switchboard when a certain button is pressed after a certain date.
This is to disable the database if payment for it's use is not
received. I placed the following code in the on_click event of one of
the buttons:
If (Now() > #6/13/2007#) Then
Dim MedDB As DAO.Database
Dim qdf As QueryDef
Set MedDB = CurrentDb
For Each qdf In MedDB.QueryDefs
DoCmd.DeleteObject acQuery, qdf.Name
Debug.Print qdf.Name & " Deleted"
Next qdf
Else
Debug.Print "It is not time yet"
End If
I get an error message saying that: "There was an error executing the
command", and in the immediate window I see:
~sq_drptWeeklyMedsByProgramThisWeek~sq_dProgram Deleted
~sq_drptWeeklyPRNByLast4~sq_dProgram Deleted
~sq_drptWeeklyPRNByProgram~sq_dProgram Deleted
~sq_drptWeeklyPRNNextWeek~sq_dProgram Deleted
~sq_drptWeeklyPRNThisWeek~sq_dProgram Deleted
~sq_dtestrptWeeklyMedsAllThisWeek~sq_dProgram Deleted
However none of the queries seems to have been deleted...what am I
doing wrong? or better yet is there an easier way to totally disable
the database after a certain date for everyone except the owner of the
database and it's tables?
switchboard when a certain button is pressed after a certain date.
This is to disable the database if payment for it's use is not
received. I placed the following code in the on_click event of one of
the buttons:
If (Now() > #6/13/2007#) Then
Dim MedDB As DAO.Database
Dim qdf As QueryDef
Set MedDB = CurrentDb
For Each qdf In MedDB.QueryDefs
DoCmd.DeleteObject acQuery, qdf.Name
Debug.Print qdf.Name & " Deleted"
Next qdf
Else
Debug.Print "It is not time yet"
End If
I get an error message saying that: "There was an error executing the
command", and in the immediate window I see:
~sq_drptWeeklyMedsByProgramThisWeek~sq_dProgram Deleted
~sq_drptWeeklyPRNByLast4~sq_dProgram Deleted
~sq_drptWeeklyPRNByProgram~sq_dProgram Deleted
~sq_drptWeeklyPRNNextWeek~sq_dProgram Deleted
~sq_drptWeeklyPRNThisWeek~sq_dProgram Deleted
~sq_dtestrptWeeklyMedsAllThisWeek~sq_dProgram Deleted
However none of the queries seems to have been deleted...what am I
doing wrong? or better yet is there an easier way to totally disable
the database after a certain date for everyone except the owner of the
database and it's tables?