View Full Version : Using *All* records in a table as criteria.


Misty
04-15-2004, 10:56 AM
Currently, I have a query where the criteria is like:
"1a1" Or "1ab" Or "2a1" Or "3f6"

Each of these are pieces of equipment that are listed in the EQUIP table.

The criteria changes often, and the only way I know how to do it is to take out and/or replace/add whatever the change is.

There has got to be a way to do this better. How about if I made another table that listed *only* the equipment to be considered and used some kind of a wildcard reference? My boss just gave me a list of like 30 more things to add to the query. What a bummer!

Database stuff is not my whole job. You can probably tell that. Don't get too wild on me with the hard stuff.

Thanks,

M ;)

pbaldy
04-15-2004, 12:37 PM
I'd do it one of two ways, Misty. Your idea of a table of the current criteria would work. Your query might look something like

SELECT *
FROM MainTable
WHERE EquipID IN (SELECT EquipID FROM NewCriteriaTable)

The other alternative, which would require more code, would be to present the user with a multiselect listbox. They could choose the items they wanted to restrict by, and your query would be built from that.