Dynamic Criteria in Query from Table

vineet78

Board Regular
Joined
Oct 22, 2017
Messages
74
Hi

I have a simple query in Which Want to use Dynamic criteria from another Table.
I want to use criteria from the table one field at one time.

Thus for 10 criterias , query needs to be run 10 times using one criteria from table at one time.

Please suggest how this is achievable.

Regards
Vineet
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
This would be one way (using union):
Code:
select * from x where [first criteria] 
union all
select * from x where [second criteria]
union all
select * from x where [third criteria]

this would be another (using Or logic)
Code:
select * from table 
where
(
    (first criteria)
    or
    (second criteria)
    or
    (third criteria)
)
 
Upvote 0
Note that if you literally want to run the query ten times (separately) than simply:
Code:
select * from x where [first criteria] 
select * from x where [second criteria]
select * from x where [third criteria]

You can run these using DoCmd in a vba subroutine or similarly using some setup with MSAccess macros in order to execute them in sequence "automatically" (or with some automation anyway).
 
Upvote 0

Forum statistics

Threads
1,221,574
Messages
6,160,602
Members
451,657
Latest member
Ang24

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