Results 1 to 5 of 5
  1. #1
    Isebrand is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    4

    Multiple Filter within a report not giving correct data.

    Trying open a report and filter the data so that I see Data from the Status_txt Field that is AWM, INW or AFD but I only want it to show the data where the CAL_AREA_1 comes from the form control of Forms!Main!KareaList

    I thought the below should work but it returns Status_txt that is AWM, INW or AFD but includes ALL Cal_Areas_1 data not just the CAL_AREA_1 That I selected on the forms


    DoCmd.OpenReport "Daily Workload List AWM-INW-AFD", acViewReport, , "STATUS_TXT = 'AWM' OR STATUS_TXT = 'INW' OR STATUS_TXT = 'AFD' AND CAL_AREA_1 = Forms!Main!KareaList"




    A Scrubbed version is hereDatabase2.zip

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try

    DoCmd.OpenReport "Daily Workload List AWM-INW-AFD", acViewReport, , "(STATUS_TXT = 'AWM' OR STATUS_TXT = 'INW' OR STATUS_TXT = 'AFD') AND CAL_AREA_1 = '" & Forms!Main!KareaList & "'"

    I added parentheses that I suspect solve the problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Isebrand is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Nov 2018
    Posts
    4
    Worked Great thanks!

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The other problem is that there is a "WHERE" clause on the button click code (that limits the records), AND a filter is set on the report load event.
    You only need one........ so I would remove the filter commands for the Report_Load event.

    (And I would use a query for the report record source instead of a table, since you are only using 11 out of 23 fields in the report.)



    Also note that the top two lines of EVERY module should be
    Code:
    Option Compare Database
    Option Explicit

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Quote Originally Posted by Isebrand View Post
    Worked Great thanks!
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. iif Function not giving me correct results
    By Ramesh Kumar C in forum Queries
    Replies: 4
    Last Post: 08-30-2017, 10:15 AM
  2. Replies: 2
    Last Post: 11-13-2014, 02:17 PM
  3. Replies: 5
    Last Post: 09-12-2014, 06:41 AM
  4. Make Table Query - giving multiple name possibility
    By huntclub in forum Database Design
    Replies: 2
    Last Post: 05-27-2014, 12:11 PM
  5. Filter data into multiple tables?
    By kilo21 in forum Programming
    Replies: 2
    Last Post: 06-08-2012, 10:44 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