Link to home
Start Free TrialLog in
Avatar of njvyas007
njvyas007

asked on

Passing Parameters to Seagate Crystal Reports

I am using a Visual Basic Application as the Front End and Crytsal Reports as the Reporting tool.  I want to generate some reports on the base of the dates provided by the user, for that I have to pass the "from date" and the "to date" to the Crystal Reports as parameters.  But every time I pass the SQL query to the crystal reports alongwith the parameters it always gives me an error and never the correct report with the data is generated.  So can u tell me how can I pass the SQL query alongwith the dates as the parameters to the Crystal Reports.  I am using VB 6.0 and Crystal Reports 8.0
Avatar of nirmal_4194
nirmal_4194

do not declare your parameter as date, declare parameter as text and then in your query - WHERE clause you convert the text into date using CDate() function.

i.e.
PARAMETERS mFromDt Text(125), mTODt Text(125);
SELECT * FROM tbl_Master WHERE FromDate >= cdate(mFromDt) AND ToDate <= cdate(mToDt)

pass your parmater as text in vb.

i hope this will solve your problem.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
My link should have solved the problem.

mlmcc