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

SQL Server and date fields

Status
Not open for further replies.

shortstuff2212

Programmer
Apr 12, 2002
35
0
0
GB
I have a report that has a record selection of

Elector.`DateAdded` >= ? AND
Elector.`DateAdded` < ?

but when running this report through an SQL Server database I get the following error.

ODBC error (Microsoft)(ODBC SQL Server Driver) COUNT field incorrect or syntax error.

If I take the record selection out, the report will run but for everything not just the ones that fall between the two dates.

Is there anyway around this?

Any help would be appreciated.

Cheers

Kath
 
Dear Shortstuff,

Can you paste your exact selection criteria and your select statement (Database/Show SQL Query).

That would help to get a better understanding of your issue.

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
If you have a stored procedure with a parameter in it, you should be applying the date criteria in the SP.

If you have Tables or Views as your data source, and you wish to prompt the user to enter dates, create 2 parameters (or a range parameter) of type datetime (SQL Server does not have just a Date type), or you may be able to use type date, but you may have to convert it to a datetime in a formula and reference the formula to get the SQL to pass to the database, then use something like:

Elector.DateAdded >= {?StartDateParm} AND
Elector.DateAdded <= {?EndDateParm}

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top