Iterate through tables

  • Thread starter Nick 'The database Guy'
  • Start date
N

Nick 'The database Guy'

Hi People,

I am using the following code to iterate through the forms ,reports,
macros (tsk tsk), and modules and close them down before exiting the
db. My problem is there is no AllTables or AllQueries object within
CurrentProject. How do I iterate through them?

Public Sub CloseAllOpenWindows()
Dim window As Variant
For Each window In CurrentProject.AllMacros
DoCmd.Close acMacro, window.Name
Next
For Each window In CurrentProject.AllReports
DoCmd.Close acReport, window.Name
Next
For Each window In CurrentProject.AllForms
DoCmd.Close acForm, window.Name
Next
For Each window In CurrentProject.AllModules
DoCmd.Close acModule, window.Name
Next

End Sub

TIA

Nick
 
B

Brendan Reynolds

AllTables and AllQueries are members of the CurrentData object rather than
of the CurrentProject object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top