How to apply common Filter for ALL access queries

Rkeev

Board Regular
Joined
Mar 11, 2014
Messages
69
I am trying to create a filter that filters any of my 330 queries regardless of the query name.
What I don't want to do is create an additional query for each of my 330 queries already in the DB.

So I am trying to create a filter that will filter a common column found in all queries that contains "MTF"
I just want to be able to apply it to whatever query I open.

I've tried a number of variations of this but I still am not getting it.
Code:
 oCmd.SetFilter WhereCondition:="[APPOINTMENT_REQUEST_STATUS_NAME] Like ""*MTF*"""


any help would truly be appreciated.

thx,

RKeev
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Too bad you didn't post more of the code surrounding that. Is the object you are trying to apply this to the active object?
filter a common column found in all queries that contains "MTF"
What if the query does not contain the MTF field?
BTW, 300 queries suggests something is not quite right with the db design.
 
Upvote 0
Micron,
Thanks for the reply. In reality there is no other code other than what I provided. I don't want to name the query because I want it to be universal.

I am pretty good at writing VBA for excel not so much in Access. I know a MACRO in excel is all VBA while a MACRO in Access can consist of built in steps called a macro so, Im sure I am not using the correct terminology regarding the Access MACRO but hopefully the below clears it up a little.

There is an Access MACRO that consists of a couple of some built in steps like , open query, run code etc but no real VBA. I was going to include the VBA generated here to use as a filter and as part of the built in MACRO steps (Open query, "run code", or apply filter).
run code is where the MACRO process would look for the vba that filters the query ( the column header is the same for all 330 queries)

I know how to create another query with the filter but because I sometimes want it filtered by MTF and sometimes I don't I want to be able to use the vba to apply the filter to these 330 and any others created in the future without having to double my query numbers.

I think I have made this more confusing than it is needed but hopefully I have explained what I am looking for.

Thanks for any help that you can provide.

Rkeev
 
Upvote 0
I don't know exactly what you mean by a query with a filter here. For access queries, you can just right click in a query field to get filter properties, or use the ribbon. Just type MTF* as the "contains" criterion.
 
Upvote 0
Thanks to all for the attempts but as it turns out it was embarrassingly basic and is now resolved.

v/r
Rkeev
 
Upvote 0

Forum statistics

Threads
1,221,816
Messages
6,162,149
Members
451,746
Latest member
samwalrus

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