Printing all reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a parameter query which fuels a report. When the report is run it
prompts for a staff number. We generally only print one or two reports but
every so often we have to send all reports to HQ.

How can I print all staff training records?

Ian
 
Hi Ian
First remove the parameter query from the report so it wont prompt you every
time you need to print the report.
Change it to a select query that returns all records
Select * From TableName

Use the Wherecondition of the OpenReport command line, to filter the report
and print a report for each staff member
================================================
Dim MyDB As Dao.DataBase , MyRec As Dao.RecordSet
Set MyDb = currentDb
' open the staff table
Set MyRec = MyDb.OpenRecordSet("Select * From [Staff Table Name]")
' start loop through the record, to print a report for each staff member
While Not MyRec.Eof
' Print the report
Docmd.OpenReport "Report Name",,, "[Staff field Name] = " & MyRec![Staff
field name in the staff table]
MyRec.MoveNext
Wend
===============================================
If the field that is used to filter the report is string type, then change
the Command line to
Docmd.OpenReport "Report Name",,, "[Staff field Name] = '" & MyRec![Staff
field & "'"
 
Back
Top