Results 1 to 7 of 7
  1. #1
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365

    How to avoid Data type mismatch in this query

    I'm getting Data type mismatch in criteria expression.


    SELECT tblMain.LastBatch


    FROM tblMain
    WHERE (((tblMain.LastBatch)>CLng("getStoreddate")));


    getStoreddate is a UDF that returns a date. But Access puts quotes around it, and I think that's the problem.
    LastBatch is a Long number field.
    How might I get this to work? Thanks.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    if it is a function, you need to include brackets

    CLng(getStoreddate())



  3. #3
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    365
    Thank you. Forgot.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Nitpicking here: those are parentheses. These are brackets: [ ]. These are braces { }.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Minty is online now VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003

    Talking

    Nope these are braces:
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    according to ascii

    DEC OCT HEX BIN Symbol HTML Number HTML Name Description
    40 050 28 00101000 ( ( &lparen; Open parenthesis (or open bracket)
    41 051 29 00101001 ) ) &rparen; Close parenthesis (or close bracket)
    91 133 5B 01011011 [ [ [ Opening bracket
    93 135 5D 01011101 ] ] ] Closing bracket
    123 173 7B 01111011 { { { Opening brace
    125 175 7D 01111101 } } } Closing brace

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    No, those are suspenders
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-29-2016, 06:09 PM
  2. Replies: 1
    Last Post: 08-28-2013, 06:11 AM
  3. Data Type Mismatch in Query
    By dunc723 in forum Queries
    Replies: 1
    Last Post: 07-24-2013, 01:38 PM
  4. Data type mismatch in query criteria
    By TinaCa in forum Queries
    Replies: 2
    Last Post: 09-19-2011, 11:31 PM
  5. Data type mismatch in query
    By thart21 in forum Queries
    Replies: 8
    Last Post: 10-01-2010, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums