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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Parameter to Subreport

Status
Not open for further replies.

Jefftopia

Programmer
Jul 30, 2002
104
US
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
'-------------------------------------------------
--------------------------------------------------------------------------------
 
I don't know the code but in linking the subreport to the main report you just form a link with the main report parameter...even if you don't use that parameter in the Main report

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top