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

Print Report based on Form checkbox

Status
Not open for further replies.

razchip

Technical User
Feb 2, 2001
133
US
I'm looking for the proper code to select a report based on a forms checked list box. I've tried If statements, but keep receiving error messages, when I click the print button.

form name is - frmMain
the list box is - Division
the numer is - 541

When Division 541 is selected, I need to print rpt541, if one of the other divisions is checked, I want to print rpt54X.

Not sure what I'm missing, but any help will be appreciated. Thanks.

Thanks for the help.
Greg
 
What is your code so far? How are all your report different? I'm just wondering why you have multiple reports with similar names.

Do you have a button that opens the report? Is "rpt54X" the actual report name or does the "X" represent another number and another report?

Duane MS Access MVP
Now help me support United Cerebral Palsy
 

Dim stDocName As String
Dim frm As Form_frmMain
Set frm = New Form


If frm!Division = 541 Then

stDocName = "R1_PnC_Clinton"

The other choices could be 542, 543 ...etc.

There are two reports as the 541 report has some blank fields that stops a query from working properly.

Thanks for the help.
Greg
 
I can see where clicking a button would cause an error. You have an "If" without an "End If".

I have no idea what the "blank fields..." statement relates to based on your intial question.

Duane MS Access MVP
Now help me support United Cerebral Palsy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top