Results 1 to 2 of 2

Thread: Select ..FROM with date

  1. #1
    Join Date
    May 2010
    Posts
    1

    Select ..FROM with date

    Can someone please help me.
    I have 2 identical tables. I need to transfert the records from 1 to the other. 4 field:
    RID autoNumber
    datum date/time
    SessionID text
    session start date/time
    I get an error: Date type mismatch in expression:

    this is the code:

    lv_sqlCmd = "SELECT RID " _
    & "FROM tblSession_OUT " _
    & "WHERE [datum] = #" & lv_rst_tblSession![datum] & "#" _
    & " AND [Session ID] = '" & lv_rst_tblSession![Session ID] & "'" _
    & "AND [session start] = #" & lv_rst_tblSession![session start] & "#;"
    Debug.Print (lv_sqlCmd)
    Set lv_rst_tblSession_OUT = lv_dbs.OpenRecordset(lv_sqlCmd)


    Debug gives this result;
    SELECT RID FROM tblSession_OUT WHERE [datum] = #05/05/2010# AND [Session ID] = '302071819' AND [session start] = #23:57:05#;

    what is wrong here?

    thanks

  2. #2
    Join Date
    Feb 2011
    Posts
    6
    The date/time fields need to be enclosed in double or single quotes

    Bert

Posting Permissions

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