VBA Access Function fExistQuery Code Only

Copy and paste this function (blue text) into a module from the Visual Basic Editor of your database.

Function fExistQuery(qName As String) As Boolean
Dim db As DAO.Database, i As Integer
Set db = CurrentDb
fExistQuery = False
db.QueryDefs.Refresh
For i = 0 To db.QueryDefs.Count - 1
     If LCase(qName) = LCase(db.QueryDefs(i).Name) Then
          fExistQuery = True 
          Exit For
     End If
Next i
Set db = Nothing
End Function

Do you like this post? Please link back to this article by copying one of the codes below.

URL:

HTML link code:

BB (forum) link code:

No comments:

Post a Comment