simple question, need keyword...

  • Thread starter Thread starter Andre L via AccessMonster.com
  • Start date Start date
A

Andre L via AccessMonster.com

I wrote a function to look thru all tables and queries in a db to find a
specified string. I used keywords: TableDefs and: QueryDefs in my code. I
want to create a similar function to look through report definititons. Is
this possible? I see no: ReportDefs variable......
 
Andre said:
I wrote a function to look thru all tables and queries in a db to find a
specified string. I used keywords: TableDefs and: QueryDefs in my code. I
want to create a similar function to look through report definititons. Is
this possible? I see no: ReportDefs variable......


That's an awful lot of work to save a few bucks on already
available add ins.

Anyway, to answer your question:

For Each doc In db.Containers("Reports").Documents
DoCmd.OpenReport doc.Name, acDesign
With Reports(doc.Name)
' do your thing here
End With
DoCmd.Close scReport, doc.Name, acSaveNo
Next doc

Starting in A2k, you could also achieve this using the
AllReports collection (see Help), but I'm not sure it makes
anything easier.
 
not sure about the addins but thanks for the code!
 
HOW DO YOU DEFINE DOC? I am using Access 2000.

Marshall said:
That's an awful lot of work to save a few bucks on already
available add ins.

Anyway, to answer your question:

For Each doc In db.Containers("Reports").Documents
DoCmd.OpenReport doc.Name, acDesign
With Reports(doc.Name)
' do your thing here
End With
DoCmd.Close scReport, doc.Name, acSaveNo
Next doc

Starting in A2k, you could also achieve this using the
AllReports collection (see Help), but I'm not sure it makes
anything easier.
 
db would of course be:

dim db as datbase
set db = curentdb()

and doc would be:

dim doc as document

HTH,
TC
 

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

Back
Top