xskydivex
asked on
Embedded Crystal Report Viewer Pops Up Enter Parameter Values After User Clicks Next Page in Viewer
Crystal Report Viewer embedded in Visual Basic 6 always promps the user for parameters after user clicks on next page in the viewer at run time.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Select Case gsReportName
Case "BBUP"
'Set and pass the parameter field to the report.
'Cycle through the ParameterFieldDefinitions collection for report
Set Report1 = Nothing
Set crpParamDefs = Report1.ParameterFields
'Change the location of each DatabaseTable in the Reports DatabaseTable Collection
For Each crxDatabaseTable In Report1.Database.Tables
crxDatabaseTable.SetLogOnI nfo "10.1.1.55", "master", "BC_Reports", "PondL@ke"
Next crxDatabaseTable
Report1.EnableParameterPro mpting = False
For Each crpParamDef In crpParamDefs
With crpParamDef
Select Case .ParameterFieldName
Case "@ForeCast"
gsForecastPeriod = Me.CboPeriod.Text
.SetCurrentValue gsForecastPeriod
Case "@DeptNo"
.SetCurrentValue gsDeptNo
Case "@CompanyID"
.SetCurrentValue glCurrCpnyID
Case "@CFiscYr"
.SetCurrentValue gsCurrCpnyNextBudgetYr
Case "@CBLedgerID"
.SetCurrentValue gsCurrCpnyNextBudgetLedger ID
Case "@PFiscYr"
.SetCurrentValue gsCurrCpnyCurrBudgetYr
Case "@PBLedgerID"
.SetCurrentValue gsCurrCpnyCurrBudgetLedger ID
Case "@PALedgerID"
.SetCurrentValue gsCurrCpnyCurrActBudgetLed gerID
Case "@F1LedgerID"
.SetCurrentValue gsCurrCpnyCurrProjForecast _1BudgetLe dgerId
Case "@F2LedgerID"
.SetCurrentValue gsCurrCpnyCurrProjForecast _2BudgetLe dgerId
Case "@F3LedgerID"
.SetCurrentValue gsCurrCpnyCurrProjForecast _3BudgetLe dgerId
Case "@PPLedgerID"
.SetCurrentValue gsCurrCpnyCurrProjBudgetLe dgerID
End Select
End With
Next
Report1.Database.Verify
iRpt = 1
Screen.MousePointer = vbHourglass
frmRptPrev.CRViewer1.Repor tSource = Report1
'Enables the SCR Animation Control
frmRptPrev.CRViewer1.Enabl eAnimation Ctrl = True
'Shows Report1
frmRptPrev.CRViewer1.ViewR eport
Screen.MousePointer = vbDefault
Unload Me
frmRptPrev.Show 1
Case "BBUP"
'Set and pass the parameter field to the report.
'Cycle through the ParameterFieldDefinitions collection for report
Set Report1 = Nothing
Set crpParamDefs = Report1.ParameterFields
'Change the location of each DatabaseTable in the Reports DatabaseTable Collection
For Each crxDatabaseTable In Report1.Database.Tables
crxDatabaseTable.SetLogOnI
Next crxDatabaseTable
Report1.EnableParameterPro
For Each crpParamDef In crpParamDefs
With crpParamDef
Select Case .ParameterFieldName
Case "@ForeCast"
gsForecastPeriod = Me.CboPeriod.Text
.SetCurrentValue gsForecastPeriod
Case "@DeptNo"
.SetCurrentValue gsDeptNo
Case "@CompanyID"
.SetCurrentValue glCurrCpnyID
Case "@CFiscYr"
.SetCurrentValue gsCurrCpnyNextBudgetYr
Case "@CBLedgerID"
.SetCurrentValue gsCurrCpnyNextBudgetLedger
Case "@PFiscYr"
.SetCurrentValue gsCurrCpnyCurrBudgetYr
Case "@PBLedgerID"
.SetCurrentValue gsCurrCpnyCurrBudgetLedger
Case "@PALedgerID"
.SetCurrentValue gsCurrCpnyCurrActBudgetLed
Case "@F1LedgerID"
.SetCurrentValue gsCurrCpnyCurrProjForecast
Case "@F2LedgerID"
.SetCurrentValue gsCurrCpnyCurrProjForecast
Case "@F3LedgerID"
.SetCurrentValue gsCurrCpnyCurrProjForecast
Case "@PPLedgerID"
.SetCurrentValue gsCurrCpnyCurrProjBudgetLe
End Select
End With
Next
Report1.Database.Verify
iRpt = 1
Screen.MousePointer = vbHourglass
frmRptPrev.CRViewer1.Repor
'Enables the SCR Animation Control
frmRptPrev.CRViewer1.Enabl
'Shows Report1
frmRptPrev.CRViewer1.ViewR
Screen.MousePointer = vbDefault
Unload Me
frmRptPrev.Show 1
ASKER
Are you intercepting the NEXT PAGE click?
------
I am not intercepting the NEXT PAGE click. Click next the enter parameters box appears. If I enter the parameters the report moves to page 2 from 1.
Now if I go to previous page(1) and then click on next. The next page appears without prompting for parameters again.
Then if I click on next page from 2 to go to 3 I am prompted again for parameters
and so on and so on till I get to the end of the report.
------
I am not intercepting the NEXT PAGE click. Click next the enter parameters box appears. If I enter the parameters the report moves to page 2 from 1.
Now if I go to previous page(1) and then click on next. The next page appears without prompting for parameters again.
Then if I click on next page from 2 to go to 3 I am prompted again for parameters
and so on and so on till I get to the end of the report.
I have never seen that or even heard about it.
Does this happen on all reports?
mlmcc
Does this happen on all reports?
mlmcc
What parameters is it prompting for?
ASKER
I have never seen that or even heard about it.
Does this happen on all reports?
mlmcc
----
Yes
Does this happen on all reports?
mlmcc
----
Yes
ASKER
matthewrhoades:
What parameters is it prompting for?
----
All of them.
What parameters is it prompting for?
----
All of them.
If it is prompting for all of the field values on the report than you have an issue with your data source connection.
1. Are there multiple records?
2. What event is the above code being run under? Is that a report load event or a current event of some sort?
1. Are there multiple records?
2. What event is the above code being run under? Is that a report load event or a current event of some sort?
ASKER
matthewrhoades:If it is prompting for all of the field values on the report than you have an issue with your data source connection.
1. Are there multiple records?
2. What event is the above code being run under? Is that a report load event or a current event of some sort?
--------
1. Yes there are mult. records.
2. Command Button Click Event.
1. Are there multiple records?
2. What event is the above code being run under? Is that a report load event or a current event of some sort?
--------
1. Yes there are mult. records.
2. Command Button Click Event.
ASKER
Found the solution on the internet:
http://visualbasic.ittoolbox.com/groups/technical-functional/vb-crystalreports-l/setting-parameters-in-crystal-reports-xi-release-2-1378987
Thanks for all of your help.
http://visualbasic.ittoolbox.com/groups/technical-functional/vb-crystalreports-l/setting-parameters-in-crystal-reports-xi-release-2-1378987
Thanks for all of your help.
Are you intercepting the NEXT PAGE click?
mlmcc