I need to write a routine that can tell if a query with a specified name already exists. I've already created something that's functional, albiet very crude. Can anyone show me the better way to do this? (I know there must be one)
Here's what I'm using now:
Query_Name = "XAQ_" & Forms![dave_module_test]![CMB_College] & "_DA_Query"
On Error GoTo Create_Error
If IsNull(DB.QueryDefs(Query_Name)) = False Then Debug.Print "Result of " & Query_Name & " Query: Exists"
Debug.Print "Result of " & Query_Name & " Query: Exists."
--query stuff here--
Create_Error:
--query doesn't exist--
Here's what I'm using now:
Query_Name = "XAQ_" & Forms![dave_module_test]![CMB_College] & "_DA_Query"
On Error GoTo Create_Error
If IsNull(DB.QueryDefs(Query_Name)) = False Then Debug.Print "Result of " & Query_Name & " Query: Exists"
Debug.Print "Result of " & Query_Name & " Query: Exists."
--query stuff here--
Create_Error:
--query doesn't exist--