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

Problems with VB & Crystal Reporting Software

Status
Not open for further replies.

Juice05

Programmer
Joined
Dec 4, 2001
Messages
247
Location
US
I am using VB 6.0 and Crystal 8.5. I have multiple reports that I need to run from my VB application. I am using the following code to access the reports via VB:

CrystalReport2.ReportFileName = "M:\Reports\EOM\Renewals.rpt"
CrystalReport2.DiscardSavedData = True
CrystalReport2.ParameterFields(1) = "BeginDate;" & eomChartStart1a & ";True"
CrystalReport2.ParameterFields(2) = "EndDate;" & eomChartEnd1a & ";True"
CrystalReport2.Connect = connct
CrystalReport2.Destination = crptToFile
CrystalReport2.PrintFileType = crptCSV
CrystalReport2.PrintFileName = "functn1a.csv"
CrystalReport2.Action = 1
intDBValues(0) = CrystalReport2.RecordsPrinted

eomChartStart1a and eomChartEnd1a are string variables that have the date in a string format. i.e. yyyy/mm/dd. Crystal is taking this value in as a string. My problem is that it seems that my parameters are not getting passed in. When I run the report through VB I get 0 records printed. If I run it using crystal with the same parameters it runs fine. Any input would be greatly appreciated.
 
Do the parameter array indices match the report, if there are only two should they be 0 and 1, not 1 and 2 ?

cjw

 
No, Crystal isn't zero based.
I found the problem. I am using a stored procedure and the stored procedure so crystal was looking at the parameters as "@BeginDate" and "@EndDate" even though the parameters were named "BeginDate" and "EndDate" within crystal. I renamed the parameters "@BeginDate" and "@EndDate", changed my code to match the naming convention and ta da!!!! It worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top