3 replies
by sl-campbell
Give this a try:
In a Module put in the declarations section a Type variable:
Private Type ParamRpt
ReportName As String
Criteria As String
'HERE you can add more variables
'
'
End Type
'And the dim it as Public
Public ReportParameters As ParamRpt
'Then in the Form's code window ?n the Event proceedure for the command button that opens the report, assign something to the variable:
Private Sub cmdOpenReport_Click()
On Error GoTo Err_cmdOpenReport_ClickDim stDocName As String
ReportParameters.ReportName = "myREPORTTITLE"
ReportParameters.Criteria = "myCRITERIA"
stDocName = "myReport"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdOpenReport_Click:
Exit SubErr_cmdOpenReport_Click:
MsgBox Err.Description
Resume Exit_cmdOpenReport_Click
End Sub
'Then in the report add 2 labels, (for this example), to the report Header:
lblTitle
lblCriteria
'Then in the code window for the reportin the Report_Open event put the following code assigning variables to the label captions:
Private Sub Report_Open(Cancel As Integer)
lblCriteria.Caption = ReportParameters.Criteria
lblTitle.Caption = ReportParameters.ReportName
End Sub
'Of course there are other ways.
by shanghai sam
by john_wills
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending