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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I print multiple reports based on user's chosen criteria? 1

Status
Not open for further replies.

keysol

Programmer
Feb 27, 2001
81
CA
Hi,

I created a form on which I have a list of report descriptions labels such as:
Report #1
Report #2
Report #3
Report #4

And to the right of each report description label I have two check boxes. One to print a report in french and the other check box to print the report in english.

I'd like to know what code I should use to be able to simply select one or many check boxes and have Access print the various reports once I click a print button. For my above example I would have a possibility to print as many as 8 different reports.


Gerr
 
Hi keysol,

You can use the "Tag" property of the check boxes. e.g. if Checkbox 1 is selected to print "Report1" set Report1 (no quotes) as the Tag of Checkbox 1.

Place this in the On Click event of your "Print" button:
On Error Resume Next
Dim ctl As Control
For Each ctl In Me.Controls
With ctl
Select Case .ControlType
Case acCheckBox
If .Value = True And Len(.Tag) > 0 Then
DoCmd.OpenReport .Tag
End If
End Select
End With
Next ctl

This procedure assumes that the Tag property will be only used on Check boxes that are naming Reports.

Bill
 
Hi Bill,

Thanks for your answer allowing me to print multiple reports based on check box selections. I did exactly as you said and it worked perfectly the very first time.

You know, when I saw the Tek-tips notification in my inbox and realized it was you responding to my posting, I knew right then that I would be getting the definitive solution to my problem.


Thanks a million.

You're the best.

Gerr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top