Results 1 to 8 of 8
  1. #1
    MFS is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235

    Criteria not working

    I have four Queries that show supply data from today and the past 2 hours as the Criteria. And another Criteria that states a 1, 2, 3 or 4. (Four Queries)
    This issue I'm having is that all Queries are working great except for the #3. Does not make any sense. All the data is supplied to the Queries from the same table.
    A copy of my Query . . .
    Click image for larger version. 

Name:	Untitled.jpg 
Views:	4 
Size:	63.5 KB 
ID:	15943
    When I do run the Query I get the following statement . . .
    "Data type mismatch in Criteria expression"



    Hopefully someone can help.

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What is the format of your date1 and time1 fields?
    What do their entries look like?

    If you remove the Criteria, does your function:
    CDate([date1] & " " & [time1])
    return valid looking values for EVERY record?

  3. #3
    MFS is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235
    Format is military time, HH:mm
    Yes, When I remove the Criteria all data looks fine.
    If I copy a working Query like the one for 2, then change the Field Zone1 to a 3 it craps out.
    The Dates and Times in the table are exactly the same as well.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I didn't even see the Criteria under "zone1".
    What is the format of the "zone1" field?

    Try to figure out which field's criteria is causing the issue. That should be pretty easy.
    Try removing the criteria under "zone1". Does it work? If so, then that criteria is the issue.
    Otherwise, try removing the criteria under your date/time calculation and see if that works.

  5. #5
    MFS is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235
    Copy of my table . .


    Click image for larger version. 

Name:	Untitled.jpg 
Views:	3 
Size:	159.0 KB 
ID:	15945

  6. #6
    MFS is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235
    Criteria under date time is what is causing it. But why for only zone 3
    All others work perfectly fine. (Zone 3 has the same dates and times)

  7. #7
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Your date1 and time1 fields look like they are left justified. That usually indicates that the format of those fields is Text, not Date/Time.
    That means you could have entries in there that are NOT valid dates or times. My guess is that you have a "bad" entry somewhere in there for one of your Zone 3 records.

    Where is this data coming from?
    Is it being imported?
    What are the fields set up to be Date/Time fields instead of Text?
    Then you would catch any issues upon importing the data.

  8. #8
    MFS is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2009
    Location
    Ohio
    Posts
    235
    Ahh, I see what your saying, okay, let me snoop around and I'll post what I come up with.

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

Similar Threads

  1. Criteria in query is not working
    By sshel55 in forum Queries
    Replies: 7
    Last Post: 10-17-2013, 04:50 PM
  2. query criteria not working
    By George in forum Access
    Replies: 3
    Last Post: 10-30-2012, 12:14 PM
  3. Multiple Criteria in query not working
    By avarusbrightfyre in forum Queries
    Replies: 3
    Last Post: 04-17-2012, 05:06 PM
  4. date criteria is not working
    By kwooten in forum Queries
    Replies: 6
    Last Post: 08-12-2011, 12:31 PM
  5. Link Criteria no working when opening new form
    By ETCallHome in forum Forms
    Replies: 1
    Last Post: 06-17-2011, 05:26 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