Passing a parameter from VB6 code to Crystal Repor
Hi.
I am passing a parameter from my VB6 code to existing crystal report file. Report is using data from MS SQL database. With out this parameter report is fine. As soon as I pass this parameter, I get an error message: âLogon Failed. Detailes: ADO Error Code: 0x80040e4d. Description: Login failed for user âmy user nameâ. SQL State 42000. Native Error 18456
My code is:
Set m_Application = New CRAXDRT.Application
Set m_Report = New CRAXDRT.Report
Set m_Report = m_Application.OpenReport(App.Path & "\ReportName.rpt", 1)
m_Report.EnableParameterPrompting = False
Set m_Parameters = m_Report.ParameterFields
For cnt = 1 To m_Parameters.Count
Set m_Parameter = m_Parameters.item(cnt)
If m_Parameter.name = "{?testcode}" Then
m_Parameter.AddCurrentValue "12345"
End If
Next
frmReportView.CRViewer1.ReportSource = m_Report
frmReportView.CRViewer1.ViewReport
frmReportView.Show
Thank you for your help.
|