Results 1 to 10 of 10
  1. #1
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54

    Creating FILTER Buttons

    Here is what my form looks like so you can get an idea:



    http://i49.tinypic.com/2lvllpi.jpg

    In the picture on the right you see 3 buttons, all, open, or closed. These don't do anything yet. When all is clicked, all records should show, when open is clicked, only records with issue status open would show, etc...

    How can I create such a filter?

  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,640
    One way is to manipulate the filter property:

    Me.Filter = "Status = 'Open'"
    Me.FilterOn = True
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    which filter property

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    The filter property of the form you're trying to filter.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    The issue I'm having is that the buttons are located in the main form, and the data is under the tab, in a subform called QList Subform.

    here is some of the code that I've been trying, for some reason Access doesn't recognize the name of my subform name (QList Subform)

    Code:
    Private Sub Open_Issue_Filter_Click()
     On Error GoTo Err_Open_Issue_Filter_Click
     
        
        'DoCmd.OpenQuery ("QList Query")
        'Me.Requery
        'Me![Qlist Subform].Requery
        'Me![Qlist Subform].SetFocus
        'Me![Qlist Subform].Form!Issue_Status.SetFocus
        
        Me![Qlist Subform].SetFocus
        
        [Qlist Subform].Form.Filter = "Issue_Status = 'Open'"
        [Qlist Subform].Form.FilterOn = True
        
        'DoCmd.ApplyFilter , "Issue_Status = 'Open'"
        
    
    Exit_Open_Issue_Filter_Click:
        Exit Sub
    
    Err_Open_Issue_Filter_Click:
        MsgBox Err.Description
        Resume Exit_Open_Issue_Filter_Click
        
    End Sub
    None of these worked because I can't get it to focus on that subform....

  6. #6
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    Figured it out here is my code, for some reason the subform is named Child39 and I can't change it...

    Code:
    Private Sub Open_Issue_Filter_Click()
     On Error GoTo Err_Open_Issue_Filter_Click
        
        Me![Child39].SetFocus
        
        [Child39].Form.Filter = "Issue_Status = 'Open'"
        [Child39].Form.FilterOn = True
    
    Exit_Open_Issue_Filter_Click:
        Exit Sub
    
    Err_Open_Issue_Filter_Click:
        MsgBox Err.Description
        Resume Exit_Open_Issue_Filter_Click
        
    End Sub

    Now my question to you guys is how can I make a similar button using similar coding to show all records again?

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

    [Child39].Form.Filter = ""
    [Child39].Form.FilterOn = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    lol yea that was a stupid question, got it thanks

    edit: you actually only need [Child39].Form.FilterOn = False

  9. #9
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    New task (similar): I need to filter data in the following manner:

    Clicking the complete button shows records where the Date_Completed column has data in it, and the incomplete button shows records where Date_Completed is empty. Here is the code that I'm trying which is not working, maybe someone can tweak it?

    Code:
    Private Sub Complete_Filter_Click()
     On Error GoTo Err_Complete_Filter_Click
        
        [Suggestions Subform].Form.Filter = Not IsNull(Date_Completed)
        [Suggestions Subform].Form.FilterOn = True
    
    Exit_Complete_Filter_Click:
        Exit Sub
    
    Err_Complete_Filter_Click:
        MsgBox Err.Description
        Resume Exit_Complete_Filter_Click
    
    End Sub

  10. #10
    Kipster1203 is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    May 2010
    Posts
    54
    NM!!! Solved it, I needed quotes around the Not IsNull....

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

Similar Threads

  1. Creating a simple filter
    By Kipster1203 in forum Reports
    Replies: 3
    Last Post: 05-18-2010, 10:00 AM
  2. Creating Sort Buttons in a Header in a list view
    By marttaaayyy!! in forum Programming
    Replies: 4
    Last Post: 03-29-2010, 11:08 AM
  3. Non-Printing Buttons?
    By Karend440 in forum Access
    Replies: 5
    Last Post: 11-30-2009, 08:03 AM
  4. Replies: 19
    Last Post: 05-12-2009, 02:59 PM
  5. Access 2003 - Creating Buttons from a Table
    By Speedy in forum Programming
    Replies: 2
    Last Post: 02-28-2009, 05:32 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