ACC 2000 - Find Text within a Query using VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to use VBA code to programmatically loop through all the
Queries in an Access 2000/2002/2003 database to find a particular string
within the Query? I am guessing I would have to loop through the Queries
collection looking within the SQL text of the query for the string?
 
Tony_VBACoder said:
Is there a way to use VBA code to programmatically loop through all the
Queries in an Access 2000/2002/2003 database to find a particular string
within the Query? I am guessing I would have to loop through the Queries
collection looking within the SQL text of the query for the string?


That's what you can do all right.

For Each qdf On db.QueryDefs
pos = InStr(qdf.SQL, "yourstring")
If pos > 0 Then
'do something
End If
Next qdf
 
Back
Top