check query exists else msgbox "query missing"

  • Thread starter Thread starter BrightIdeas
  • Start date Start date
B

BrightIdeas

Before running code I would like to check the result query has been
created and is still in the database.
check query exists else msgbox "query missing"

What code would I use ? is this an error thing or is there some code
for "query does exist"?


thanks
 
Public Function QueryExists(QueryName As String) As Boolean
On Error Resume Next

QueryExists = IsObject(CurrentDb().QueryDefs(QueryName))

End Function
 
Back
Top