using checkbox to exclude records from query (1 Viewer)

M Costumes

Member
Local time
Today, 11:19
Joined
Feb 9, 2021
Messages
75
I've done a search through the forums, and found a couple threads that are similar, but I don't fully understand the answers.

I have a query with various parameters on a form the user can select from combo boxes. I'd like to add a check box so that if it is ticked it will exclude any record that includes a setID. SetID is not one of the parameters, but is one of the columns that is returned in the query table. Would that be adding a criteria to the SetID in the query? I have a hunch it might be an IIF statement, but I'm not sure how to write that. Any insight is appreciated! Thanks!
 

plog

Banishment Pending
Local time
Today, 13:19
Joined
May 11, 2011
Messages
11,638
IncludeNullSetID: iif(Forms!YourForm!YourCheckbox=True AND Isnull(SetID), 0,1)

Then in the criteria section underneath put a 1
 

M Costumes

Member
Local time
Today, 11:19
Joined
Feb 9, 2021
Messages
75
@plog Thanks! I'm still pretty new at this. If I'm working in query design view, where would that first line you typed go? Is that it's own column?
 

plog

Banishment Pending
Local time
Today, 13:19
Joined
May 11, 2011
Messages
11,638
Yes in its own column as a new field
 

M Costumes

Member
Local time
Today, 11:19
Joined
Feb 9, 2021
Messages
75
@plog Thanks! Do I need to include the table before setID in the brackets at the end. So it would be AND IsNull (tblName.SetID),0,1)
 

Users who are viewing this thread

Top Bottom