check query exists else msgbox "query missing"

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
 
D

Douglas J. Steele

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

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

End Function
 
Top