Hello all,
I have (hopefully) an easy question for you all. I'm running Access '03 and have created a pile of VBA code to create a form and some queries related to each control in the form. (Basically, it uses structured naming conventions to create a form with a bunch of combo boxes that allow the user to easily add and remove controls... anyway--)
I am using the statement
- With CurrentDb
-
.QueryDefs.Delete ("qryName")
-
Set qrydef = .CreateQueryDef("qryName", strSQL)
-
.Close
-
End With
to delete existing queries and make new ones, however my code returns an error message when the query doesn't exist when it tries to delete it.
Is there a function that can tell me if a query with a specific name exists that I can use in an "If" statement? Ideally, it would be something like:
- If qryExists("qryName") Then
-
.QueryDefs.Delete("qryName")
-
End If
Any help would be greatly appreciated!
Thanks!