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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

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