I’m trying to use some code I wrote a while ago but it doesn’t seem to work. Now I’m wondering if it ever did.
When it gets to the line ‘For Each qfield In qdef.Fields’ it drops out to the last ‘End if’.
If I modify it to work with tables it works fine.
Sub InspectMyQueries()
‘cycle through the queries
‘retrieve those used to make tables for arcview – begin with ‘p’
‘get any fields in those queries longer than 10 characters
Dim db As DAO.Database
Dim qdef As DAO.QueryDef
Dim qfield As DAO.Field
Dim strInfo As String
Set db = CurrentDb
For Each qdef In db.QueryDefs
If Left(qdef.Name, 1) = “p” Then
‘Debug.Print qdef.Name
For Each qfield In qdef.Fields
If Len(qfield.Name) > 10 Then
strInfo = qdef.Name & vbTab & qfield.Name
Debug.Print strInfo
End If
Next
End If
Next qdef
End Sub