David McAfee
davidmcafee at gmail.com
Fri Oct 10 17:57:24 CDT 2014
So, I'm trying to figure out if my logic is correct. I have a form with a couple of check boxes (chkEligibility & chkGathere). I have 40+ possible steps/actionqueries that need to run. Here is a very over simplified example: Step Elegibility Gathered 1 2 3 X 4 X X 5 X X 6 X X 7 X (I'm not sure if the X's lined up correctly after the email gets sent away...) Steps 4,5& 6 are under eligibility, 3-7 are gathered. So the way this works is: Steps 1 & 2 will Always run If chkGathered is checked, 3 & 7 will also run, but 4-6 will only run if chkGathered and chkEligibility are both checked If chkEligibility is checked, but Gathered isn't, only steps 1 & 2 will run. I originally was using a procedure to change the queryDef based on two different check box combinations, and I decided to just make one query dynamic instead. The following query DOES work correctly, but it just seems messy / ugly. Is there a way to simplify it? Am I overlooking something obvious? SELECT PKID, Step, Task, Action, Started, Completed, EligibilitySection, GatheredSection FROM tblMiniCostReportBuildSteps WHERE (Completed=0 AND EligibilitySection=False AND (GatheredSection=IIf([forms]![frmBuildMiniCostReport]![chkGatherMode]=False,False,[forms]![frmBuildMiniCostReport]![chkGatherMode] In (True,False)))) OR (Completed=0 AND EligibilitySection=False AND GatheredSection=False) OR (Completed=0 AND (EligibilitySection=IIf([forms]![frmBuildMiniCostReport]![chkEligibilityMode]=False,False,[forms]![frmBuildMiniCostReport]![chkEligibilityMode] In (True,False))) AND (GatheredSection=IIf([forms]![frmBuildMiniCostReport]![chkGatherMode]=False,False,[forms]![frmBuildMiniCostReport]![chkGatherMode] In (True,False)))); Thanks in advance... David