Running Reports

Galstar

New member
Local time
Today, 08:00
Joined
Feb 24, 2005
Messages
6
I have several objects on the form that allows me to print reports. One object shold allow me to run the report but with a different query due to the math.

How if open/runnign report from button can i chaneg the recordsource of the report?

Private Sub PTReport_Click()
On Error GoTo Err_PTReport_Click

Dim stDocName As String
If Forms!Reports!Math = "<" Then

DoCmd.OpenReport stDocName, acViewPreview
Reports.RPT_AFPT_Results.RecordSource = "qry_APFT_Results"

Else
DoCmd.OpenReport stDocName, acPreview
Reports!RPT_AFPT_Results.RecordSource = "qry_APFT_ResultsII"

End If

The lines in red will not run. I know this becuase the report is already open. Can you pass info to the report when it is opening??
 
Try in the open event of the report.
 

Users who are viewing this thread

Back
Top Bottom