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!

Why isn't this query working...

Status
Not open for further replies.

JasSim

Programmer
Jul 24, 2000
12
0
0
US
This queries a msaccess 2000 database full of records. I haven't ever gotten any records to return from this query though.???? Does anyone know what is happening, as I am new to crystal. This is in the Crystal SQL designer. This is what I type in to the parameters (sdate= 7/7/01, edate= 9/9/01) Thanks!

SELECT
Orderlog.`Order`,
Orderlog.`Proc`,
Orderlog.`OpenDate`
FROM
`Orderlog` Orderlog
WHERE
Orderlog.`OpenDate` BETWEEN CDate({?sDate}) AND CDate({?eDate})
ORDER BY
Orderlog.`Order` ASC
 
What is the Value type you had set for the two parameter fields?

Also, what is the data type of Orderlog.`OpenDate` ?

Cheers,
- Ido ixm7@psu.edu
 
Sorry...
The data type of OpenDate is Date/Time.
String data types for the parameters.
 
Cdate() returns a date type, not DateTime.

Try to convert the parameter string value
to a DateTime type.

Cheers,
- Ido
ixm7@psu.edu
 
This is the new query:
SELECT
Orderlog.`Order`,
Orderlog.`Proc`,
Orderlog.`OpenDate`
FROM
`Orderlog` Orderlog
WHERE
Orderlog.`OpenDate` BETWEEN CDateTime({?sDate}) AND CDateTime({?eDate})
ORDER BY
Orderlog.`Order` ASC

This is the error message I receive:
ODBC Error:[Microsoft][ODBC Microsoft Access Driver]Undefined Function `CDateTime` in expression.

Thanks for your help, I am trying to become more familiar with Crystal
 
CDateTime() is not an oracle or Access query funtion to my knowledge

if OpenDate is a datetime field then set your parameters to be datetime type or use the Access equivalent to an Oracle To_Date function to convert a string to a datetime
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top