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

Passing parameters to report thru VB 6

Status
Not open for further replies.

smrati

Programmer
Jun 26, 2003
9
IN
I am having Win XP and using VB 6 and Sql server in my application.
I created reports using Crystal report version 4.6.1.0

My report is working fine when i call it in VB without using any selection formula.
EG
If the code is
Private Sub Command2_Click()
CrystalReport2.Action = 1
(the statement CrystalReport2.PrintReport also works similarly)
End Sub

This code works fine to display the report

BUT....
When i use a selection formula to facilitate parameter passing in Crystal report ,Report is not displayed.

EG:
if the code is as follows:

Private Sub Command2_Click()
CrystalReport2.SelectionFormula = "{OPDpatient_transaction.OPDregno} = " & Text1.Text
CrystalReport2.Action = 1

(here the statement CrystalReport2.PrintReport doesnt show following error but report is not displayed)

End Sub


Then there is an Run time error:
error no:20536
Unable to connect ;Incorrect Log on parameters


I have also tried Replaceselectionformula..it also gives same error.
Also i tried parameterfield property but that property is not avalable with my version of crystal report.

Please i am too much in problem.Can any one help me out?

Thanks a lott

 
If, instead of using a parameter, you are setting the record selection criterion directly via VB, you should completely remove the parameter from the report.

If you want to set the value of the parameter via VB, you should use methods such as AddCurrentValue (depending on the value type of the parameter).

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top