Results 1 to 3 of 3
  1. #1
    mrmmickle1's Avatar
    mrmmickle1 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Location
    North Carolina
    Posts
    78

    MS Access Query Error: DataType Mismatch in Criteria Expression?

    I am getting this error message when I try to run my update query: DataType Mismatch in Criteria Expression



    I have a validated form that users input dates into. It should not be possible to enter an invalid date.


    Here is my SQL Statement.
    Code:
    INSERT INTO [INPUT_GreenSheets_Plates_Archive]
    SELECT * FROM [INPUT_GreenSheets_Plates]
    WHERE 1 = 1
    AND CDBL(DATESERIAL(YEAR([RecordTime]), MONTH([RecordTime]), DAY([RecordTime]))) >= 42005
    AND CDBL(DATESERIAL(YEAR([RecordTime]), MONTH([RecordTime]), DAY([RecordTime]))) <= 42165
    AND [Status] = "Completed"
    Dates Are: 1/1/2015 & 6/10/2015

    DataType is Date/Time i.e. 6/3/2015 8:52:39 AM
    What does this error mean? Can someone please help me to resolve my issue?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    You are using wildcard to select all fields. Is this causing selection of an autonumber field? Does destination table have autonumber field?

    I think the fields in both tables must be in the same order in table design.

    Is there possibility RecordTime will be Null for any records?
    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.

  3. #3
    mrmmickle1's Avatar
    mrmmickle1 is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Sep 2014
    Location
    North Carolina
    Posts
    78
    June7,

    Thanks so much. Somehow a blank or null value got into my date field. That was the issue! The query works perfectly now.

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

Similar Threads

  1. Replies: 3
    Last Post: 07-21-2014, 09:33 AM
  2. Replies: 4
    Last Post: 05-17-2013, 04:00 PM
  3. Replies: 1
    Last Post: 05-02-2013, 01:29 AM
  4. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  5. datatype mismatch in criteria expression
    By CyberSkillsz in forum Access
    Replies: 1
    Last Post: 06-14-2011, 10:56 AM

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