Results 1 to 4 of 4
  1. #1
    tgall is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Location
    na
    Posts
    38

    Filter query to False on a Boolean (YN) Field

    Short trip: How do I build a query that filters records to only those where Boolean = False?



    Scenic view: The Access database is linked to tables on a SQL Server. One of those tables, dbo_tblRequestAnswer has a Boolean field of Yes/No, which Access assigns data type Yes/No.
    The table has 3.7 million records. I built a query to filter dbo_tblRequestAnswer to:
    1) Those whose RequestID = [Forms]![frm00Menu].txtRequestID. Works.
    2) Those whose originalAnswerIndicator = No (False). Doesn't work. No records appear.

    The resulting record set is then saved in a maketable, entitled mktblqry05.
    When I don't insert any "where" criteria, the originalAnswerIndicator field is filled with -1 or 0.

    The following is the query:
    SELECT DISTINCT dbo_tblRequestAnswer.RequestID, dbo_tblRequestAnswer.originalQuestionID, dbo_tblRequestAnswer.originalAnswerIndicator, dbo_tblRequestAnswer.originalAnswerDescription INTO mktblqry05
    FROM dbo_tblRequestAnswer
    WHERE (((dbo_tblRequestAnswer.RequestID)=[Forms]![frm00Menu]![txtRequestID]) AND ((dbo_tblRequestAnswer.originalAnswerIndicator)=Fa lse));

    How can I make the "False" segment work?

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Code:
    AND ((dbo_tblRequestAnswer.originalAnswerIndicator)=False));
    should work, but so should:
    Code:
    AND ((dbo_tblRequestAnswer.originalAnswerIndicator)=0));
    Try the second and see if it works.

  3. #3
    tgall is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2015
    Location
    na
    Posts
    38
    Joel, thank you for responding to my question. I changed False to 0 in the SQL rather than the query wizard. No records appeared.
    I also tried True and -1. No records.

    I also created a maketable of just the record set filtered from [Forms]![frm00Menu].txtRequestID. The maketable assigned originalAnswerIndicator data type Yes/No.
    The field is filled with 0 and -1. I then created a query of the maketable and tried to filter to False. No records.

    I opened the maketable in Datasheet View and right-click-filtered on 0. The table filtered to just the 0 records.

    I don't understand why the query SQL doesn't filter the records.

  4. #4
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    A few things to try:
    - Try making it just a Select query at first and see if it returns any records
    - Try removing the other criteria so you just have this boolean field criteria and see if that returns any record

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

Similar Threads

  1. Replies: 4
    Last Post: 06-18-2015, 09:37 PM
  2. Replies: 8
    Last Post: 10-06-2014, 03:02 PM
  3. Replies: 2
    Last Post: 05-18-2013, 08:58 PM
  4. Replies: 12
    Last Post: 02-10-2013, 10:13 AM
  5. Multiple Boolean in Query Problem
    By lacharnold in forum Queries
    Replies: 2
    Last Post: 04-29-2012, 01:29 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