Results 1 to 5 of 5
  1. #1
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727

    Filter Button on Split Form

    I have this code set to a button on a split form. It filters out all the blank records for the "Status" column.




    Private Sub cmdFilterPendingStatus_Click()

    Me.Filter = "[Status]"
    Me.FilterOn = True
    Me.Requery
    Me.txtFilterNamePlate.SetFocus

    End Sub

    I would like to do the exact opposite and filter out everything except for the blank records in the "Status" column.


    How can I change the code to do this? I guess I should also mention that the "Status" field is a long text/memo box but I can easily change this to short text if I really have to. I realize that short text can do the blank filtering within the split form itself by clicking on that tiny arrow in the column header but I am trying to make it really user friendly where the user can just click a button to do this. The long text box has some options to filter but not for blank fields in a record which makes me think that this may not be possible to do if the Status field remains a long text box. Some examples for the filtering options that are available in the split form for a long text box are: Begins with, contains, ends with, etc... however, when I type "" to try and filter out everything except the records that have null in the Status field, it says that "" is not valid. Anyway, sorry for making this so long. I think you guys get the picture.

    What can I do to get the results I need?


  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Generally speaking, you shouldn't have Columns with blank values because it makes querying more complex (case in point).

    Assuming you're actually allowing the Status Column to be completely devoid of anything, the following should work.
    Code:
    Private Sub cmdFilterPendingStatus_Click()
        Me.Filter = "[Status] IS NULL"
        Me.FilterOn = True
        Me.Requery
        Me.txtFilterNamePlate.SetFocus
    End Sub

  3. #3
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    I have had to do this recently in access 2007. What I did was

    filter the data to how I wanted to have it displayed.
    And then Save the Form.
    Next design the form and look at the filter property for the form, copy this value to your clipboard.
    make a macro that does "Apply Filter"
    in the where condition paste the value you previous copied.
    you can leave the other 2 fields for the macro (filter name and control name) empty.
    save the macro.

    then add a command button to the form, using the wizard set the command button to run the macro you just created.

  4. #4
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Thanks I will try this later and let you know how it works out. Thanks again.

  5. #5
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Thanks it worked really well. Can't believe something to simple was so hard for me. I was trying to use that NULL in every combination I thought possible and could not figure it out. Thanks for the help.

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

Similar Threads

  1. Filter Split Form using listboxes
    By Delta729 in forum Access
    Replies: 2
    Last Post: 01-06-2015, 10:59 PM
  2. Filter Split Form using ListBox and .ME
    By clchris_80 in forum Access
    Replies: 3
    Last Post: 01-17-2013, 07:30 PM
  3. multiiple filter on a split form
    By webisti in forum Forms
    Replies: 1
    Last Post: 04-06-2012, 12:36 PM
  4. Filter or FindRecord in Split Form
    By P5C768 in forum Forms
    Replies: 4
    Last Post: 03-20-2012, 12:16 PM
  5. Replies: 28
    Last Post: 03-08-2012, 06:47 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