Results 1 to 5 of 5
  1. #1
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22

    reading a check box to apply a filter to a list form

    I have a list view on my database and several check boxes on it. I want to click a button at the top of the form that restricts the view to only those rows that have that check box ticked. I just can't get the syntax right to make this work.

    The form looks like this



    Click image for larger version. 

Name:	form1.JPG 
Views:	13 
Size:	47.5 KB 
ID:	14055

    and I'm trying to do an applyfilter command but whether I reference the control or the field I can't make it work - it just prompts me for the value most of the time.

    Click image for larger version. 

Name:	form2.JPG 
Views:	13 
Size:	14.9 KB 
ID:	14056

    What should I be putting in the applyfilter command ?

    Simon

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    I would try: [cat_cables] = -1

    Also one could right click and apply the filter that way....

    Another approach is to use a query for the record source with the criteria for cat_cables to be <>-1 and then requery the form

  3. #3
    mrojas is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Location
    Concord California
    Posts
    72
    I would also try

    If [cat_cables].value=true then
    ' apply filter or use the Record Source property and apply filter there, then requery
    ' You may have to requery the form
    endif

  4. #4
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Try this -
    Code:
    DoCmd.ApplyFilter , "[cat_cables] = True"
    http://msdn.microsoft.com/en-us/libr.../ff197651.aspx

  5. #5
    Turncloud is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2013
    Posts
    22
    NTC's answer worked - probably the others would have as well.

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

Similar Threads

  1. Filter By Form and Apply Filter Buttons
    By JustLearning in forum Forms
    Replies: 13
    Last Post: 02-18-2015, 01:01 PM
  2. Replies: 1
    Last Post: 04-28-2013, 09:43 PM
  3. Replies: 2
    Last Post: 02-25-2013, 10:47 AM
  4. Replies: 5
    Last Post: 02-07-2013, 12:21 PM
  5. How to filter dates using an apply filter code.
    By Jgreenfield in forum Reports
    Replies: 4
    Last Post: 11-15-2011, 01:38 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