Results 1 to 8 of 8
  1. #1
    sshel55 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    Maryland
    Posts
    4

    Red face Criteria in query is not working


    I am a pretty novice user overall and brand new to Access 2010. I am running a simple query against a table. In the criteria for a field, I specify a number, say 13. But when I run the query, it returns all numbers, not just those that are 13. I don't recall having this issue in Access 2007. What am I missing? If the field is designated to be a text field, rather than a number, would this affect what is returned by the query? How can I restrict my query to the data I want to see? PS. No coding answers please. I don't write code.

    Thank you for your help.

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Post your SQL statement for analysis

  3. #3
    sshel55 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    Maryland
    Posts
    4
    SELECT dbo_DONTRNS.DTTRYR, dbo_DONTRNS.DTTRMO, dbo_DONTRNS.DTTRDA, dbo_DONTRNS.DTDONR, dbo_DONTRNS.DTTRAN, dbo_DONTRNS.DTUNIT, dbo_DONTRNS.DTPROD
    FROM dbo_DONTRNS
    WHERE (((dbo_DONTRNS.DTTRYR)=13) AND ((dbo_DONTRNS.DTTRMO)=10) AND ((dbo_DONTRNS.DTTRAN)="010"));

    Damn is now given. thanks.

  4. #4
    sshel55 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    Maryland
    Posts
    4
    If I do a Make Table query, using these criteria it seems to work fine and filter the items I want to see. But when I just do a simple select query, it returns many records that don't match my criteria!?

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Are fields "DTTRYR" and "DTTRMO" text type fields also?

  6. #6
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    If DTTRYR is a text type field, put quotes around the value 13 => "13" and see what happens.

  7. #7
    sshel55 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    Maryland
    Posts
    4
    Quote Originally Posted by ssanfu View Post
    Are fields "DTTRYR" and "DTTRMO" text type fields also?
    No they are numeric fields. I had tried the " " and it didn't help. Any ideas why the make table query would work but the select query would not work? That's really odd to me.

  8. #8
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Steps -
    1) Open a new query in design mode
    2) switch to SQL mode
    3) copy your code from post #3
    4) paste that code to replace the SQL stub
    5) Click the run button

    Review to see if there are results where DTTRYR is not 13.

    If so, do these steps:

    6) Save the query as testqry1.
    7) Create a new query. Paste the following as the code
    Code:
    SELECT DTTRYR FROM testqry1 
    WHERE DTTRYR <> 13;
    8) Run it. See if there are results.


    My guess - you are seeing DTTRDA = 13, not DTTRYR = 13.

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

Similar Threads

  1. query criteria not working
    By George in forum Access
    Replies: 3
    Last Post: 10-30-2012, 12:14 PM
  2. Multiple Criteria in query not working
    By avarusbrightfyre in forum Queries
    Replies: 3
    Last Post: 04-17-2012, 05:06 PM
  3. date criteria is not working
    By kwooten in forum Queries
    Replies: 6
    Last Post: 08-12-2011, 12:31 PM
  4. Replies: 9
    Last Post: 05-05-2011, 02:05 PM
  5. Replies: 0
    Last Post: 04-08-2010, 12:22 PM

Tags for this Thread

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