If you want to check if query exists in the database or not.
Here is the code-
Option Compare Database
Sub check_if_QUERY_exits()
Dim QRY As DAO.QueryDef
Dim found As Boolean
Dim QRY_name_to_check As String
QRY_name_to_check = "Query1"
found = False
For Each QRY In CurrentDb.QueryDefs
If QRY.Name = QRY_name_to_check Then
found = True
Exit For
End If
Next
If found = True Then
MsgBox "Query Found", vbInformation
Else
MsgBox "Query Not Found", vbInformation
End If
End Sub
Download Access Database
No comments:
Post a Comment