Using checkbox to edit criteria

C

Chad

I have a table (Table1) that has a field referred to as 'Type'. For some of
the records, 'Type' is null and for others there is data in that field.

I would like to run a query that returns the records from thTable1 where
'Type' Is Null based on whether a checkbox is checked on a form, however, I
am unsure as to how to accomplish this. Here is the query that I have now
which is not working:

Select * FROM Table1 WHERE Table1.Type IIF(chkType = FALSE, Is Null, Is Not
Null);

Thank you in advance for your help.
 
K

KARL DEWEY

Try this --
Select *
FROM Table1
WHERE (Table1.Type Is Null AND [Forms]![YourFormName]![chkType] = FALSE) OR
(Table1.Type Is Not Null AND [Forms]![YourFormName]![chkType] = True);

You probably may need True in the first part and False in the last part.
 
J

John W. Vinson

I have a table (Table1) that has a field referred to as 'Type'. For some of
the records, 'Type' is null and for others there is data in that field.

I would like to run a query that returns the records from thTable1 where
'Type' Is Null based on whether a checkbox is checked on a form, however, I
am unsure as to how to accomplish this. Here is the query that I have now
which is not working:

Select * FROM Table1 WHERE Table1.Type IIF(chkType = FALSE, Is Null, Is Not
Null);

Thank you in advance for your help.

SELECT * FROM Table1
WHERE (Forms!YourForm!chkType = True AND Type IS NOT NULL)
OR
(Forms!YourForm!chkType = False AND TYPE IS NULL)
 
C

Chad

Thanks for your help guys!

John W. Vinson said:
SELECT * FROM Table1
WHERE (Forms!YourForm!chkType = True AND Type IS NOT NULL)
OR
(Forms!YourForm!chkType = False AND TYPE IS NULL)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top