Well, it's mighty close to too much information <G>, but I can see some general things that will help you out.
For one thing, it sounds like you have people stored in several different tables. If that's the case, it will be better to store all of the people in one table and then you can store PersonID in the other tables. It will make maintenance a bunch easier, though it will mean rewriting all this sql.
When I said do the combo boxes one at a time, I wasn't very clear. What I meant is first do one. Then get the system working for two, allowing for choices to be made in one, the other, or both. Then add another one, allowing for all the possibilities.
You'll end up doing a bunch of concatenating. Here's an example, using bogus controls and tables (totally untested aircode):
strSql = "SELECT CarID, MakeName, ColorName, Year" _
& " FROM (tblCar INNER JOIN tblColor ON tblCar.ColorID = tblColor.ColorID)" _
& " INNER JOIN tblMake ON tblCar.MakeID = tblMake.MakeID"
if nz(me!cmbMake) > 0 then
strWhere = " AND tblCar.MakeID = " & me!cmbMake
end if
if nz(me!cmbColor) > 0 then
strWhere = " AND tblCar.Color = " & me!cmbColor
end if
if nz(me!txtYear) > 0 then
strWhere = " AND tblYear = " & me!txtYear
end if
if len(strwhere) > 0 then
strsql = strsql & mid(strWhere, 5)
end if
What I've done here is to isolate the parts that will stay the same (the SELECT and FROM clauses) from the rest of it, so that I won't have to maintain multiple copies of that in code. The other nifty trick is to put the " AND " at the start of each clause, so that they come together properly and it's always OK to lop off the first 4 characters when I concatenate.
Clearly your situation is more complex than this. You'll have to be clear with the users (probably on screen) about what's being ANDed and what's being ORed. You'll have to make a decision about whether or not it's too slow to always include all of the tables when you do your select, even if the user is not filtering on all of the tables. That's certainly the way I would go at first, as it will be most straightforward. But if it's really slow, you may not want to put the users through all that wait when it's not necessary.
How about if you give this strategy a go and get back to us with where you've gotten. But start with two items and work your way up.
Jeremy =============
Jeremy Wallace
AlphaBet City Dataworks
Take a look at the Developers' section of the site for some helpful fundamentals.