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!

On Click Button - event procedure

Status
Not open for further replies.

ProtegeV2

Technical User
Sep 9, 2004
40
0
0
CA
I have a report based on a query where:

WHERE (((tblSchedule.[Cheque Date]) Between [Enter start cheque date] And [Enter end cheque date]) AND ((tblSchedule.Decision)=[Enter Decision A or R (Approvals/Refusals)]))

I would like the event procedure to display a report named "rptPrimaryCategory" if they select Decision "A", or display "rptPrimaryCategoryR" if they select Decision "R".

Here is my On_Click:

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click

Dim stDocName As String

stDocName = "rptPrimaryCategory"
DoCmd.OpenReport stDocName, acPreview

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

I think that's all you need. Please be specific, I'm not a programmer! Thank you.
 
Use a form for the parameters instead of the default query input box.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top