P
Paul James
I'm using the code below to print a list of all the queries in a database,
along with their fields, and it works fine. However, I would like to add
some code that would also display the table(s) which contain those fields.
In addition, it would also be great if I could also include code that would
print out a result showing any criteria in that field. (What I'm using this
for is to determine all fields in my queries that contain criteria, and use
that as a guide to index those fields to improve performance).
Public Sub EnumQueryFields()
Dim db As DAO.Database
Set db = CurrentDb
Dim qdf As QueryDef, fld As Variant '(fld As Field) didn't work
Dim n As Integer
n = 0
For Each qdf In db.QueryDefs
For Each fld In qdf.Fields
If Not Left(qdf.Name, 1) = "~" Then
n = n + 1
Debug.Print n & "," & qdf.Name & "," & fld.Name
End If
Next fld
Next qdf
Set fld = Nothing
Set qdf = Nothing
End Sub
Thanks in advance,
Paul
along with their fields, and it works fine. However, I would like to add
some code that would also display the table(s) which contain those fields.
In addition, it would also be great if I could also include code that would
print out a result showing any criteria in that field. (What I'm using this
for is to determine all fields in my queries that contain criteria, and use
that as a guide to index those fields to improve performance).
Public Sub EnumQueryFields()
Dim db As DAO.Database
Set db = CurrentDb
Dim qdf As QueryDef, fld As Variant '(fld As Field) didn't work
Dim n As Integer
n = 0
For Each qdf In db.QueryDefs
For Each fld In qdf.Fields
If Not Left(qdf.Name, 1) = "~" Then
n = n + 1
Debug.Print n & "," & qdf.Name & "," & fld.Name
End If
Next fld
Next qdf
Set fld = Nothing
Set qdf = Nothing
End Sub
Thanks in advance,
Paul