Print Selected Reports

WineSnob

Not Bright but TENACIOUS
Local time
Yesterday, 19:02
Joined
Aug 9, 2010
Messages
211
I have a table [tblReportList] that lists all the reports. Each report (record) also has a checkbox (Print).
I have a form that lists the reports and shows the check box.
What I would like to do is have the user select the reports they want to print by checking the print checkbox. Then hit a button [Print Selected Reports].
Do I need to have code for each report with an if statement or can code look at each record and if checkbox print=true then docmd.printout?
I am not sure which way to approach this problem.
Thanks.
 
I'd probably open a recordset on an SQL statement that pulled all records with True and print those.
 
What would be the syntax to Print the records?

Code:
Private Sub btnPrintSelected_Click()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("SELECT tblReportList.Report, tblReportList.Print FROM tblReportList WHERE tblReportList.Print=True")

End Sub
 
Along the lines of

DoCmd.OpenReport rst!Report

within a loop of the records returned.
 
Thanks AGAIN Paul,
Here it is for the next one with the same question.
Code:
Private Sub btnPrintSelected_Click()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("SELECT tblReportList.Report, tblReportList.Print FROM tblReportList WHERE tblReportList.Print=True")
Do While Not rst.EOF
DoCmd.OpenReport rst!Report
rst.MoveNext
Loop
End Sub
 
Happy to help...send Cabernet!! :p
 
I've attached a sample that I have used in the past. The code is really poor. It was written almost 20 years ago for Access 2.0 and I think there are easier methods. But basically, the form offers a list box with the available reports. You can select individuals or multiples and move them to the "selected" box. When you are done, you press the run button and a parameter form pops up. The code looks at the parameters needed for each selected report and only prompts once. It then uses the entered value for every selected report that takes that parameter.
 

Attachments

Users who are viewing this thread

Back
Top Bottom