I am attempting to call up a report and imposing parameters (date). I have done this often enough, but the difference here is that the report contains 3 subreports. It is in the subreports where I would need the paramaters to go.
Here is the code I am using to call the report. How could I alter this code to impose parameters on subreports within this report?
visual basic code:--------------------------------------------------------------------------------
Dim Response As String
Response = InputBox("Enter Date (m/d/yyyy):", "Enter Date"
'Empty length string is returned when user selects 'Cancel'.
If Response = "" Then
Exit Sub
End If
'Make sure user enters a date.
If IsDate(Response) = False Then
MsgBox "Please enter a date.", vbOKOnly + vbExclamation, "Invalid User Entry"
Exit Sub
End If
'--------Encapslulated code opens cr report--------
Dim Report As New rptBuySchedule
Dim crPDefs As CRAXDRT.ParameterFieldDefinitions
Dim crPDef As CRAXDRT.ParameterFieldDefinition
Set crPDefs = Report.ParameterFields
For Each crPDef In crPDefs
With crPDef
Select Case .ParameterFieldName
Case "SettleDateParm"
.AddCurrentValue CDate(Format(Response, "mm/dd/yy"
)
End Select
End With
Next
Report.EnableParameterPrompting = False
frmRptView.CRViewer1.ReportSource = Report
frmRptView.Show
frmRptView.CRViewer1.ViewReport
'-------------------------------------------------
--------------------------------------------------------------------------------
Here is the code I am using to call the report. How could I alter this code to impose parameters on subreports within this report?
visual basic code:--------------------------------------------------------------------------------
Dim Response As String
Response = InputBox("Enter Date (m/d/yyyy):", "Enter Date"
'Empty length string is returned when user selects 'Cancel'.
If Response = "" Then
Exit Sub
End If
'Make sure user enters a date.
If IsDate(Response) = False Then
MsgBox "Please enter a date.", vbOKOnly + vbExclamation, "Invalid User Entry"
Exit Sub
End If
'--------Encapslulated code opens cr report--------
Dim Report As New rptBuySchedule
Dim crPDefs As CRAXDRT.ParameterFieldDefinitions
Dim crPDef As CRAXDRT.ParameterFieldDefinition
Set crPDefs = Report.ParameterFields
For Each crPDef In crPDefs
With crPDef
Select Case .ParameterFieldName
Case "SettleDateParm"
.AddCurrentValue CDate(Format(Response, "mm/dd/yy"
End Select
End With
Next
Report.EnableParameterPrompting = False
frmRptView.CRViewer1.ReportSource = Report
frmRptView.Show
frmRptView.CRViewer1.ViewReport
'-------------------------------------------------
--------------------------------------------------------------------------------