getting query criteria from one source (1 Viewer)

deejay_totoro

Registered User.
Local time
Today, 16:56
Joined
May 29, 2003
Messages
169
Hello :cool:,

I am not sure of the best way to achieve the end results - so hoping someone can help!

I have many queries in one database that all use the same criteria, for example, in a table with a list of names, I select the following names::

Jones
Smyth
Cameron
Blair
Brown

The list is actually quite long and changes (randomly) almost daily. So everyday I have to edit the criteria in all of my queries, ie:

"jones" or "smyth" or "cameron" or "blair" or "brown"
Becomes
"McDonald" or "Stevenson" or "Busby" etc...

With so many queries using the exact same criteria, I think it would be better to store this criteria in a module, and send it to each query as required. Then I would only have to edit the criteria in the module, as each query would take its criteria from the module.

I don’t know where to start with this one. Any help would be appreciated!

Cheers!

dj_T
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 08:56
Joined
Aug 30, 2003
Messages
36,133
Rather than a module, I'd store them in a table. You could join that table to your regular table in your query. The correct join should return the correct records (instead of a criteria).
 

hawkpig

Registered User.
Local time
Today, 16:56
Joined
Jun 5, 2007
Messages
10
If all of these queries relate to one particular table then you may want to consider creating a "master query" with all other queries being based on that query rather than off the table directly. That way any changes that need to be global to all other queries can be made to the master query and will have instant effect on the queries that run off this master query.

Pbaldy's idea is also a suitable way to filter records, where you have an exceptions table that is joined to your primary data table. (You could combine his suggestion with mine for a robust quick fix for future amendments or additions)
 

Users who are viewing this thread

Top Bottom