I need to retrieve only the date part of the datetime field in my select statement. Is there a way to do this?
Printable View
I need to retrieve only the date part of the datetime field in my select statement. Is there a way to do this?
Code:Dim sql$
Dim Db As DAO.Database
Dim Rs As DAO.Recordset
:
:
sql = "SELECT DateValue(MyDateTime) As DisplayDate FROM tblMyTable WHERE ....;"
Set Rs = Db.Openrecordset(sql,dbopenSnapshot)
Tried it but I got an error: 'DateValue' is not a recognized function name.
Here is my SQL statement that I'm trying to use. I want it to be grouped by the date but it keeps grouping by the datetime.
SHAPE{SELECT RefNo, RefPart, DateValue(Date) As Date, Author, Description, StyleID, Customer, GrandTotal, sOrderedQty = CASE Ordered WHEN '0' THEN '' ELSE CAST(OrderedQty AS CHAR) END, sOrdered = CASE Ordered(Date >= '5/11/2000 12:00:00 AM' AND Date <= '5/11/2000 11:59:59 PM') ORDER BY Date, RefNo, Author, Customer, GrandTotal} AS ReportChild COMPUTE ReportChild BY Date
Any suggestions?
I had to use CONVERT(Char, Date, 101) As Date in the SQL SELECT Statement