Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

know how to print reports without knowing their names? 1

Status
Not open for further replies.

20fva

Technical User
Dec 17, 2002
7
US

wondering anyone had a snippet they could share

i want to write a routine using a do while loop that prints all the current reports in a database,
im wondering if there is a way to access reports by a number?

Thanks all.

--------
Claudia
 
Hi Claudia,

Straight from the Help files:

Sub AllReports()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllReports collection.
For Each obj In dbs.AllReports
If obj.IsLoaded = TRUE then
' Print name of obj.
Debug.Print obj.Name
End If
Next obj
End Sub

Just remove:the if statement in the loop

Hope it helps
 
if you want to print the actuel reports change the lines to
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
For Each obj In dbs.AllReports
docmd.openreport obj.Name
Next obj
 

Beeps what do you mean straight from the help files?
vba editor help files? sorry if it was.

i don't have it currently installed. i thought i did a full instalation of xp access, but it says i need to reinsert cd.

i'll get the cd and install it before i ask anymore questions.

pwise your snippet was especially helpful.

i'm not sure what Beeps snippet does. I thought debug.print would tell me what reports are open. but i dont see any thing when i call that sub from a button. with or without reports currently loaded.

Thankyou both. helpful indeed.

--------
Claudia
 
pwise is correct.

my snippet is an example from the help files that will get all the open reports and print the name in the immediate window.

I didn't remove the if loop and put in the
docmd.openreport obj.name
otherwise, same as pwise code

Sorry if confusing

Thanks pwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top