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

parameters passed to SQL datasource

Status
Not open for further replies.

jc82196

Programmer
Dec 9, 2003
4
US
[Microsoft][ODBC Microsoft Access Driver] COUNT field incorrect
Issue Description: I followed the directions on how to use parameter
fields in my sql command but they do not work.
I get a message
[Microsoft][ODBC Microsoft Access Driver] COUNT field incorrect

This is what i put in the sql command database
WHERE (tblWorkorders.DateFinished = {?Dates})
?Dates is a parameter field in the report.
The reason to due this is my SQL statement joins 4 tables using
subqueries. It process all the records but takes 5 minutes to load data
for 1 day. I would like to retrieve only the dates I specify to speed up
the query.
@dates is a parameter field RANGE
 
I think you'll need to post your entire sql command in order to get a reasonable response (I assume you mean the SQL statement in a Command object you've created in CR 9). Also, although your odbc error message includes a reference to Access, it's usually helpful if you provide info about your data connection method (such as odbc or oledb) and backend database.
 
It is ODBC and its a command in crystal reports for visual studios .net 2003. The entire sql is too long. Basically this.
SELECT *
FROM table
WHERE date = {?Dates}

Ive tried a number of different things
{?Dates}
{*Dates}
 
can't you just add the following to your record selection formula and let crystal insert the line?

{table.datefield} = {?Dates}


 
First, I think we're talking apples and oranges, because the parameters you can create for command objects (i.e., within a command object) cannot be a Range type (at least it can't in CR 9). They can only hold a single value. If you've created a Crystal parameter, you can only use it in the Record Selection formula, as jambu suggests. But, then, the filtering will be done on the client and not at the database.

So, please verify that your parameter has been created within the context of the command object itself. In your report, go to Database | Database Expert and right-click on the command object listed "Selected tables" section of the Expert. Select "Edit Command". On the right side of the Modify Command dialog is a box labeled "Parameter List". Does your parameter {?Date} exist there? If not, click on Create and add the parameter and then make you use this parameter in your WHERE clause of the command object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top