[2003] Read Parameters From Report
Hello,
I have created a form which loads up a Crystal Report (.rpt file) and displays it on the screen.
The Crystal report has a parameter set up which prompts for a range of ID's.
This means that when I run it in Crystal, I get prompted to select a Start ID and and End ID, and the report runs for only the ID's in this range.
However, in VB when I display the report it simply produces the report based on the last set of parameters chosen in Crystal, and doesn't give me the option to select a different range each time.
Therefore I thought I could set up a form with text boxes and combo boxes on, that would read the parameters from the .rpt file and populate the text and combo boxes accordingly.
Firstly, is this possible ?
Secondly, how would I do this ?
Cheers,
J.
Re: [2003] Read Parameters From Report
Yes you will be able to do that.
On the form with CRviewer you can have extra code as follows:
Report.DiscardSavedData 'Clear data saved with report
For i = 1 To 7 'Depending on number of params
Report.ParameterFields(i).ClearCurrentValueAndRange
Next i 'Clear the parameter values used previous
'Passing Parameters
Report.ParameterFields(1).AddCurrentRange (Form.txtText(0).Text)
Report.ParameterFields(2).AddCurrentValue (Form.DTPicker(0).Value)
Report.ParameterFields(3).AddCurrentValue (Form.DTPicker(1).Value)
Report.ParameterFields(4).AddCurrentValue (Form.DTPicker(2).Value)
Report.ParameterFields(5).AddCurrentValue (Form.DTPicker(3).Value)
Report.ParameterFields(6).AddCurrentValue (Form.DTPicker(4).Value)
Report.ParameterFields(7).AddCurrentValue (Form.txtText(2).Text)
Report.ParameterFields(8).AddCurrentValue (Form.cboText.Text)