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!

Run two Reports

Status
Not open for further replies.

McFestoe

Technical User
Dec 16, 2003
145
GB
I have the following code on a button which runs a report, is it possible for this button to run two reports so if a field equals A it prints report 1 if the same field equals b in prints report 2, iam lookin in right direction or should i be looking at queries.



Private Sub Service_Report_Button_Click()
On Error GoTo Err_Service_Report_Button_Click

Dim stDocName As String

stDocName = "Service Letters"
DoCmd.OpenReport stDocName, acPreview

Exit_Service_Report_Button_Click:
Exit Sub

Err_Service_Report_Button_Click:
MsgBox Err.Description
Resume Exit_Service_Report_Button_Click

End Sub
 
Sure its possible. You can remove some of your extra code too =]

Private Sub Service_Report_Button_Click()
If Field.Value = "A" Then
DoCmd.OpenReport "Service Letters",acPreview
Else
DoCmd.OpenReport "The Other One",acPreview
End If
End Sub

-Pete
 
Thanks for the help, it worked a treat, and gave me a idea two use two quires aswell the filter the info for each report.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top