From: Chad on
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.


From: KARL DEWEY on
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.

--
Build a little, test a little.


"Chad" wrote:

> 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.
>
>
From: John W. Vinson on
On Thu, 8 Apr 2010 14:42:01 -0700, Chad <Chad(a)discussions.microsoft.com>
wrote:

>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)
--

John W. Vinson [MVP]
From: Chad on
Thanks for your help guys!

"John W. Vinson" wrote:

> On Thu, 8 Apr 2010 14:42:01 -0700, Chad <Chad(a)discussions.microsoft.com>
> wrote:
>
> >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)
> --
>
> John W. Vinson [MVP]
> .
>
 | 
Pages: 1
Prev: Select Record Query
Next: Select Query