Lookup the hidden system table MSysObjects to see if it has an entry of Type
5 (a query) with the Name you want:
If Not IsNull(DLookup("ID", "MSysObjects", _
"(Name = 'MyQuery') AND (Type = 5)")) Then
Alternatively, examine the QueryDefs collection.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Gareth Tonnessen" <lu******@aol.comNOJUNK> wrote in message
news:20***************************@mb-m05.aol.com...
I need to have a clean way to determine whether a query exists without
trying to open it and getting an error message. Is there a simple way to
determine whether an object exists in a database?
Remove obvious from e-mail address.
Gareth Tonnessen
Lu******@att.netNOJUNK