L
.Len B
I have a report whose filter is being built by a form with 2
txt boxes for a date range and 8 chk boxes to specify which
Roles to include in the data.
Here is what I have so far.
="(ContactDate >= #" & [txtOpenDate] & "#) AND (" &
"ContactDate <= #" & [txtCloseDate] & "#) AND (" &
IIf([chkRole2],"(txtRoleID = 2) OR "," ") &
IIf([chkRole3],"(txtRoleID = 3) OR "," ") &
IIf([chkRole4],"(txtRoleID = 4) OR "," ") &
IIf([chkRole5],"(txtRoleID = 5) OR "," ") &
IIf([chkRole6],"(txtRoleID = 6) OR "," ") &
IIf([chkRole7],"(txtRoleID = 7) OR "," ") &
IIf([chkRole8],"(txtRoleID = 8)"," ") & ")"
chkRole1 has label 'ALL' and checks or unchecks 2 thru 8 from where
the user can subtract or add more Roles. I don't see it being
useful in the logic.
I am having trouble with the 'OR' portions. As it stands, unless
Role 8 is checked there is a trailing OR. If I move the ORs to the
beginning I have a leading OR unless Role 2 is Checked.
Is there some other logic I can use to generate the desired string?
txt boxes for a date range and 8 chk boxes to specify which
Roles to include in the data.
Here is what I have so far.
="(ContactDate >= #" & [txtOpenDate] & "#) AND (" &
"ContactDate <= #" & [txtCloseDate] & "#) AND (" &
IIf([chkRole2],"(txtRoleID = 2) OR "," ") &
IIf([chkRole3],"(txtRoleID = 3) OR "," ") &
IIf([chkRole4],"(txtRoleID = 4) OR "," ") &
IIf([chkRole5],"(txtRoleID = 5) OR "," ") &
IIf([chkRole6],"(txtRoleID = 6) OR "," ") &
IIf([chkRole7],"(txtRoleID = 7) OR "," ") &
IIf([chkRole8],"(txtRoleID = 8)"," ") & ")"
chkRole1 has label 'ALL' and checks or unchecks 2 thru 8 from where
the user can subtract or add more Roles. I don't see it being
useful in the logic.
I am having trouble with the 'OR' portions. As it stands, unless
Role 8 is checked there is a trailing OR. If I move the ORs to the
beginning I have a leading OR unless Role 2 is Checked.
Is there some other logic I can use to generate the desired string?