Size limit to Immediate Window in Code View?

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

I have an Access project and am simply trying to get a list of all the
query/views, so have the following bit of vba:

Public Sub PrintQueryNames()
For Each AccessObject In CurrentData.AllQueries
Debug.Print AccessObject.Name
Next
For Each AccessObject In CurrentData.AllTables
Debug.Print AccessObject.Name
Next
For Each AccessObject In CurrentData.AllViews
Debug.Print AccessObject.Name
Next

End Sub

But when I run it in the immediate window I can see it cycle through all
1000 queries/views, but when I copy the list it only contains 199 rows.
It's as if the Immediate window is just a 199 row view.

Is there a limit to the output size of the immediate window? and if so,
how can I get all 1000 query names out?

Any help greatly appreciated.....Thanks, Jason
 
Yes, there's a limit to how much can be written to the Immediate window, and
200 lines sounds about right.

You could write the output to a text file:

Public Sub PrintQueryNames()
Dim intFile As Integer
Dim strFile As String

' Set this to wherever you want the output to be saved.
strFile = "C:\Folder\File.txt"
intFile = FreeFile
Open strFile For Output As #intFile

For Each AccessObject In CurrentData.AllQueries
Print #intFile, AccessObject.Name
Next
For Each AccessObject In CurrentData.AllTables
Print #intFile, AccessObject.Name
Next
For Each AccessObject In CurrentData.AllViews
Print #intFile, AccessObject.Name
Next

Close #intFile
Application.FollowHyperlink strFile

End Sub
 
Many thanks Doug...that works a treat. What does the # signify in from of
the intFile variable name? (I'm just trying to understand the code fully).

Regards.....Jason
 
It's part of the syntax for the VBA commands. I believe it's optional in the
Open and Close statement, but required in the Print statement, so I use it
in all three to be consistent.
 
Back
Top