Results 1 to 4 of 4

Thread: SQL Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    I need to retrieve only the date part of the datetime field in my select statement. Is there a way to do this?

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    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)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    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?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    188

    GOT IT

    I had to use CONVERT(Char, Date, 101) As Date in the SQL SELECT Statement

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width