473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Using Null in query criteria

TD
I have a form that has a frame control named fraComplaint. I have a
query that I need to return records that have an empty Date_Closed
field when the value of fraComplaint is 2 and all records when the
value of fraComplaint is 1(the only two values possible for
fraComplaint are 1 and 2).

In the criteria section on the query I put this statement,
"([tblCustomerComplaints]![Date_Closed] Is Null)" ,without the dbl
quotes and it works correctly.

If I use this
statment,"IIf([Forms]![frmReportsExtQlty]![fraComplaints]=2,([tblCustomerComplaints]![Date_Closed]
Is Null),([tblCustomerComplaints]![Date_Closed]))", again without the
dbl quotes, then it returns zero records. Why?

Thanks,
TD

Jun 1 '06 #1
4 6577
TD

Anyone?

Jun 1 '06 #2
I will venture in, although no expert.

I made a test query with the first example and then looked at the sql
view of resultant query.

When I attempted the second example the sql view looked entirely
different.

However my test was not exactly like yours so I the parallel may not be
there.

Could you do that and cut and past the two different resulting sql
statements in replay and maybe we can figure out why it is not working
from them.

Jun 1 '06 #3
TD wrote:
I have a form that has a frame control named fraComplaint. I have a
query that I need to return records that have an empty Date_Closed
field when the value of fraComplaint is 2 and all records when the
value of fraComplaint is 1(the only two values possible for
fraComplaint are 1 and 2).

In the criteria section on the query I put this statement,
"([tblCustomerComplaints]![Date_Closed] Is Null)" ,without the dbl
quotes and it works correctly.

If I use this
statment,"IIf([Forms]![frmReportsExtQlty]![fraComplaints]=2,([tblCustomerComplaints]![Date_Closed]
Is Null),([tblCustomerComplaints]![Date_Closed]))", again without the
dbl quotes, then it returns zero records. Why?

Thanks,
TD

You could create a calc'd column. Ex:
Expr1:frmReportsExtQlty]![fraComplaints]
In the first 2 criteria rows enter
1
2

Now drop the Date_Closed field into a column
In the first Criteria row, leave it blank
In the second, enter
Is Null

This creates an OR statement (see View/SQL from the menu). You are
saying If Complaints is 1, show all recs. If Complaints is 2, show all
recs where DateClosed is null.

Jun 1 '06 #4
TD
You ain't nothing but the man!!! Worked like a charm.
salad wrote:
TD wrote:
I have a form that has a frame control named fraComplaint. I have a
query that I need to return records that have an empty Date_Closed
field when the value of fraComplaint is 2 and all records when the
value of fraComplaint is 1(the only two values possible for
fraComplaint are 1 and 2).

In the criteria section on the query I put this statement,
"([tblCustomerComplaints]![Date_Closed] Is Null)" ,without the dbl
quotes and it works correctly.

If I use this
statment,"IIf([Forms]![frmReportsExtQlty]![fraComplaints]=2,([tblCustomerComplaints]![Date_Closed]
Is Null),([tblCustomerComplaints]![Date_Closed]))", again without the
dbl quotes, then it returns zero records. Why?

Thanks,
TD

You could create a calc'd column. Ex:
Expr1:frmReportsExtQlty]![fraComplaints]
In the first 2 criteria rows enter
1
2

Now drop the Date_Closed field into a column
In the first Criteria row, leave it blank
In the second, enter
Is Null

This creates an OR statement (see View/SQL from the menu). You are
saying If Complaints is 1, show all recs. If Complaints is 2, show all
recs where DateClosed is null.


Jun 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jennifer | last post by:
I have a query with 5 possible criteria via a form. If criteria is not entered, I use the like Nz() function on the backend query to use an "*" for criteria fields left blank. The query is not...
6
by: Megan | last post by:
Hi everybody- I'm trying to use a checkbox to control whether or not a date field in a query "Is Null" or "Is Not Null." I have 2 date fields: InDate and OutDate. If there is an OutDate, then...
1
by: RiesbeckP | last post by:
Hi All, I have a DB where there are customer numbers and a few other fields. I want to be able to pull all of the null records for a particular field as well as all the other customer numbers...
3
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
2
by: ILCSP | last post by:
Hello, I'm in the process of changing our 'normal' Access 2000 update queries to Update Pass Through Queries. We have a SQL server 2000 database and we're using an Access 2000 database as our...
3
by: Simon | last post by:
Dear reader, I found out a strange behaviour in a query of the type Total (summation query). In case of a normal select query with a criteria setting Is Null for field-A, four (4) records...
7
by: keliie | last post by:
Hello Just a quick question that I've spent a few hours trying to solve with no luck (although one would think this should be fairly easy). I have a form with a subform. The subform is based...
0
prabirchoudhury
by: prabirchoudhury | last post by:
CRITERIA; +-------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+-------+...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.