Results 1 to 7 of 7
  1. #1
    Xarkath is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Millcreek WA
    Posts
    92

    Problem Filtering table in a sub-form

    Hello,

    I am trying to filter a table viewed on a sub-form through criteria applied on the main form. There are 6 possible criterias and 5 of the 6 filters are set so that if the criteria is assigned then the form filters to that but if left blank then the filter is not assigned. Those five are working great but the 6th is slightly different and I cant figure it out.

    The 6th criteria is based an a status. What I am trying to do is filter by the assigned status but if a status is not assigned then I want to see all records where the status is not "Complete".



    I have tried multiple formulas but no matter what it continues to populate records with "Complete" as the status right along with all the others.


    Here are just 3 of the formulas I have tried. I have also tried multiple variations using IsNull, Is Null and Eval.

    [Forms]![Work Items]![Status] or <>”Complete”
    <>"Complete" or [Forms]![Work Items]![Status]
    IIF([Forms]![Work Items]![Status]="",<>"Complete",[Forms]![Work Items]![Status])


    Any advice would be greatly appreciated.

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Is the main form bound?

    How are you applying the filter? Dynamic parameterized query? Or VBA code? I prefer the latter: http://www.allenbrowne.com/ser-62code.html
    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
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    [Forms]![Work Items]![Status] or <>”Complete”
    I think this won't work because you haven't provided a field to compare against.

    This is similar to http://access.mvps.org/access/queries/qry0001.htm

    Try
    Code:
    [Forms]![Work Items]![Status] or [Forms]![Work Items]![Status]<>”Complete”

  4. #4
    Xarkath is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Millcreek WA
    Posts
    92
    Thanks for the replies. I will do my best to supply a little more detail.

    The main form is unbound and consists of 6 combo boxes from which to select the filter criterias.

    The subform is bound to a table (COBRA_Inv). To set the criteria on the sub-form I enter into the Record Source so that it looks like a Design Query. Then I enter the formulas within the Criteria row. The first of the 6 options is GrpNum so I have entered the formula as : [Forms]![Work Items]![Status] or [Forms]![Work Items]![Status] Is Null. This works as intended, If left null/blank then all records show otherwise only records where the group number matches GrpNum are displayed.

    for the part I posted as <>"Complete" I have also tried applying it as [COBRA_Inv]![Status]<>"Complete" but like all the other variations it has had no affect.

    Thanks

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Since you can't get the filtering to work correctly, I would back June's suggestion about using VBA from Allen Browne's site to filter the records. Much better method to filter records.

  6. #6
    Xarkath is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2013
    Location
    Millcreek WA
    Posts
    92
    Hello,

    This is now solved but I am a little perplexed as to the problem. All I did was re-enter the formula but I left off the quotes on "Complete" and left them for Access to assign which it did. Comparing that to a screen shot I took the formula looks exactly like my last attempt but despite looks it now works.

    Forms![Work Items]![Status] or [COBRA_Inv]![Status] <>"Complete"



    Thanks

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    The quote marks are different fonts in the original post. I have known Access to have issue with the slanted.
    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.

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

Similar Threads

  1. Filtering table inside a form
    By Liam87 in forum Forms
    Replies: 3
    Last Post: 10-31-2012, 09:37 PM
  2. Replies: 14
    Last Post: 03-07-2012, 03:46 AM
  3. Problem with filtering on DATE Variable
    By SIGMA248 in forum Programming
    Replies: 1
    Last Post: 04-01-2011, 10:33 AM
  4. Date Filtering problem
    By TubbyGrey in forum Access
    Replies: 6
    Last Post: 10-22-2010, 10:46 PM
  5. Problem filtering a report
    By mrk68 in forum Reports
    Replies: 1
    Last Post: 05-03-2009, 09:31 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