Access Button - Apply 2 Filters

SantasLittleHelper

Board Regular
Joined
Nov 25, 2016
Messages
77
I'm trying to create a button (on a form) which applies 2 different filters at the same time.

1. Only Show records which have the same 'BO' Number as the current record
AND
2. Only Show records where 'Status' is Blank

I've tired a few ways but I can't see to get it to work.

Does anybody have any suggestions?
 
I've tested each part on their own:

Filtering just on the BO works... but I have to enter the BO into the 'Enter Parameter Value' pop-up.
The Status doesn't work - it returns a blank record. I'm guessing it is an issue with the code because I'm able to filter successfully via the macro.
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
If you get the parameter value window for BO, then the name is incorrect, so Access is asking you for what BO is meant to be ?
If the status is NULL, then change the check?


You have to use the correct field name and the correct control name for BO.


Private Sub Command121_Click()
Me.Filter = "BO = " & Me.BO & " AND Status IS NULL"
Me.Filteron = True
End Sub


I am also assuming that the button is on the form that has the BO number on it.?
 
Upvote 0
Note that you have to be very specific about what you mean by Blank as it has no real meaning for Access data.

It could mean:
  • an empty string ""
  • Null
  • a space or another invisible or unprintable character
  • any combination of the above (such as "Null Or Empty String", or "Null or empty string or space")

For the sake of completeness, if you are importing data or using external data it can get even weirder (depending on what a blank means in the original data, and then what happens when it is imported or used by MSAccess). So you have to test thoroughly in that situation.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,484
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top