What coding is required to check if query "X" currently exists. If it does exist, delete it and move on to the next step. If it doesn't, move on to the next step?
Public Function QueryExists(QueryName As String) As Boolean
Dim varDummy As DAO.QueryDef
On Error Resume Next
Set varDummy = CurrentDb().QueryDefs(QueryName)
QueryExists = (Err.Number = 0)
End Function
You can now use:
If QueryExists("X") Then
MsgBox "Yes"
Else
MsgBox "No
End If
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.