This is also posted in the VB5/6 forum but they said I would have better luck here...
I am re-writing a customer tracking database in VB/SQL2000 and using crystal reports 7.0.
I have managed to get a report running passing one parameter to the stored proc and it returns the correct data to the report and displays it. Here is the code:
crView.ReportFileName = App.Path & "\reports\PatientInformation.rpt"
crView.StoredProcParam(0) = frmDats.datPatient.Recordset.Fields("CustID"
crView.Action = 1
Now my problem is I have another report that I got the stored proc working and when in design mode in Crystal Report builder it returns correct data. However, when I call it in VB I get an error and cannot figure out why...
Run-time error '20553':
Error in file <path to report>: Invalid Parameter Name
This is the code I am using to call it:
crReports.ReportFileName = App.Path & "\reports\TotalNewSetups.rpt"
crReports.StoredProcParam(0) = txtStartDate.Text
crReports.StoredProcParam(1) = txtEndDate.Text
crReports.StoredProcParam(2) = cboSalesRep.Text
crReports.Action = 1
Yes all the text/combo boxes are filled with the same data I used to test the stored proc in SQL enterprise manager which returns data. I have searched and found lots of hits but nothing that answers why my parameters aren't passing.... I have also found if I dont specify the parameters in VB (rem out the .storedprocparam lines) a dialog boxes opens asking for all the parameter values, once I type in the same information as I would in VB, the report runs.
Here is my stored proc code to incase I have something wrong there, I can run this procedure with values instead of parameters and get data back.
CREATE PROCEDURE sp_TotalNewSetups
@StartDate NVARCHAR(50),
@EndDate NVARCHAR(50),
@SalesRep NVARCHAR(50)
AS
SELECT <fields>
FROM <tables>
WHERE
([ztblPatientInfo].[SalesRep] = @SalesRep AND
[ztblPhysician].[ShippedDate]>= @StartDate And [ztblPhysician].[ShippedDate]<= @EndDate AND
([ztblPatientInfo].[OrderStatus]='shipped' Or [ztblPatientInfo].[OrderStatus]='completed'))
GO
I am re-writing a customer tracking database in VB/SQL2000 and using crystal reports 7.0.
I have managed to get a report running passing one parameter to the stored proc and it returns the correct data to the report and displays it. Here is the code:
crView.ReportFileName = App.Path & "\reports\PatientInformation.rpt"
crView.StoredProcParam(0) = frmDats.datPatient.Recordset.Fields("CustID"
crView.Action = 1
Now my problem is I have another report that I got the stored proc working and when in design mode in Crystal Report builder it returns correct data. However, when I call it in VB I get an error and cannot figure out why...
Run-time error '20553':
Error in file <path to report>: Invalid Parameter Name
This is the code I am using to call it:
crReports.ReportFileName = App.Path & "\reports\TotalNewSetups.rpt"
crReports.StoredProcParam(0) = txtStartDate.Text
crReports.StoredProcParam(1) = txtEndDate.Text
crReports.StoredProcParam(2) = cboSalesRep.Text
crReports.Action = 1
Yes all the text/combo boxes are filled with the same data I used to test the stored proc in SQL enterprise manager which returns data. I have searched and found lots of hits but nothing that answers why my parameters aren't passing.... I have also found if I dont specify the parameters in VB (rem out the .storedprocparam lines) a dialog boxes opens asking for all the parameter values, once I type in the same information as I would in VB, the report runs.
Here is my stored proc code to incase I have something wrong there, I can run this procedure with values instead of parameters and get data back.
CREATE PROCEDURE sp_TotalNewSetups
@StartDate NVARCHAR(50),
@EndDate NVARCHAR(50),
@SalesRep NVARCHAR(50)
AS
SELECT <fields>
FROM <tables>
WHERE
([ztblPatientInfo].[SalesRep] = @SalesRep AND
[ztblPhysician].[ShippedDate]>= @StartDate And [ztblPhysician].[ShippedDate]<= @EndDate AND
([ztblPatientInfo].[OrderStatus]='shipped' Or [ztblPatientInfo].[OrderStatus]='completed'))
GO