Hello everyone,
Does anyone know how to loop through all queries to print SQL-text of each?
My task is to find name of queries that use function ROUND.
I created the following code:
However, I am getting non-expected results.
Any help is appreciated.
sudakov.
Does anyone know how to loop through all queries to print SQL-text of each?
My task is to find name of queries that use function ROUND.
I created the following code:
Code:
Public Function varSearchStringInQueries()
Dim db As Database
Dim qdf As QueryDef
Dim strSQL As String
Dim varPosition
Dim lngCounter As Long
Set db = CurrentDb()
For Each qdf In db.QueryDefs
lngCounter = lngCounter + 1
strSQL = qdf.SQL
varPosition = InStr(1, strSQL, "round")
If Nz(varPosition, 0) <> 0 Then
Debug.Print qdf.Name
End If
Next
Debug.Print "Number of processed queries = " & CStr(lngCounter)
End Function
However, I am getting non-expected results.
Any help is appreciated.
sudakov.