473,511 Members | 10,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Null values are excluded from my parameter query!

I have a search form with a subform that holds the results.
Three text boxes are search criteria:
First Name
Last Name
Address

The criteria in the subform parameter query are like below:
Like "*" & [Forms]![frmPersonLookup]![txtAddress] & "*"

My problem is that if someone is in there with a blank address, there
is no way for me to find them. If i specify their first name
properly, they are still not included in the results. If I go back to
the table and add anything in their address field, they will then show
up in the results.

HELP!

Thanks.
Jan 27 '08 #1
4 3092
ni********@hotmail.com wrote in
news:63763522-0e7a-4231-a7be-
f9**********@j78g2000hsd.googlegroups.co
m:
I have a search form with a subform that holds the results.
Three text boxes are search criteria:
First Name
Last Name
Address

The criteria in the subform parameter query are like below:
Like "*" & [Forms]![frmPersonLookup]![txtAddress] & "*"

My problem is that if someone is in there with a blank address,
there is no way for me to find them. If i specify their first
name properly, they are still not included in the results. If I go
back to the table and add anything in their address field, they
will then show up in the results.

HELP!

Thanks.
null is not LIKE anything, nor is null equal to anything, nor is it
unequal to anything.

The only ways out are to convert the null to something or test for
null

add: OR Address is null
to your criteraa
--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jan 27 '08 #2

<ni********@hotmail.comwrote in message
news:63**********************************@j78g2000 hsd.googlegroups.com...
>I have a search form with a subform that holds the results.
Three text boxes are search criteria:
First Name
Last Name
Address

The criteria in the subform parameter query are like below:
Like "*" & [Forms]![frmPersonLookup]![txtAddress] & "*"

My problem is that if someone is in there with a blank address, there
is no way for me to find them. If i specify their first name
properly, they are still not included in the results. If I go back to
the table and add anything in their address field, they will then show
up in the results.

HELP!

Thanks.
Try this:

Like "*" & Nz([Forms]![frmPersonLookup]![txtAddress],"") & "*"

Fred Zuckerman
Jan 27 '08 #3
I tried these and still no luck. They still either display no
records, or will always display the nulls no matter what.
Anything else I can try?
Jan 27 '08 #4
"glockshooter1" <ni********@hotmail.comwrote in message
news:db**********************************@i12g2000 prf.googlegroups.com...
>I tried these and still no luck. They still either display no
records, or will always display the nulls no matter what.
Anything else I can try?
You're right: as Bob Quintal explained, Null doesn't match anything.

Switch the query to SQL View (View menu.)

In the WHERE clause, you will see something like this:
WHERE (([SomeField]) Like "*" &
[Forms]![frmPersonLookup]![txtAddress] & "*") AND ...

Change it like this:
WHERE (([Forms]![frmPersonLookup]![txtAddress] Is Null) OR
([SomeField] Like "*" & [Forms]![frmPersonLookup]![txtAddress] &
"*")) AND ...

Watch the brackets: they're important when you mix AND and OR.

How it works
=========
A WHERE clause is an expression that evaluates to True or False or Null for
each record. Only the records where it is True are included. Therefore we
craft the expression to return True for all records when the text box is
null.

When the text box is null, the expression:
([Forms]![frmPersonLookup]![txtAddress] Is Null)
is True, and the expression:
[SomeField] Like "*" & [Forms]![frmPersonLookup]![txtAddress] & "*")
is Null.

The result of an OR is True if either part is True (regardless of the other
part.) So when the text box is null, this expression yields True ('coz the
first part is true), regardless of what is actually in the field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

Jan 28 '08 #5

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

Similar topics

7
7038
by: Douglas Buchanan | last post by:
I cannot access certain column values of a list box using code. I have a list box 'lstPrv' populated by the query below. SELECT tblPrv.fkPrvID, lkpCat.CatNm, lkpSrv.SrvNm, lkpCat.pkCatID,...
2
19316
by: PK | last post by:
Hi, I have an application that opens a Crystal report document and passes in a value to a parameter in the report (pointing to an Oracle DB). However, if I want to pass a "null" value to retrieve...
6
5905
by: doncee | last post by:
I have a list box that is generated on a form by way of a Parameter Query. Problem is whenever I try to refer to the list box, i.e., to update the underlying table, I am getting a "null" value...
4
32725
by: Shwetabh | last post by:
Hi, My question is, is there any difference between a NULL and a Blank (Unknown, Not Applicable) field in MS SQL or are they the same? Awaiting your comments, Regards
1
3455
by: Pieter Coucke | last post by:
Hi, A given column of my Report (reporting services 2005) contains clients or null values. I want the user to be able to chose one or more clients for the parameter, and than show only those...
5
5491
by: John | last post by:
I just cannot manage to perform a SELECT query with NULL parameter... My CATEGORY table does have one row where TCATEGORYPARENTID is null (real DB null value). TCATEGORYID and TCATEGORYPARENTID...
9
2808
by: Yitzak | last post by:
Hi spent a few hours on this one wrote a query that joined on results of 2 other queries. Qry3 using Qry1 and Qry2 When I used Qry1.FasText <cstr(Qry2.FasInteger) in the where clause - got...
3
3376
by: bobdydd | last post by:
Hi Everybody I am trying to be able to filter records by whether the date field which is called "RiskDate" in the recordset, is either: 1. Is Null 2. Not Null The parameter in the query...
2
14641
by: qwedster | last post by:
Folk! How to programattically check if null value exists in database table (using stored procedure)? I know it's possble in the Query Analyzer (see last SQL query batch statements)? But how...
0
7245
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
7356
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
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7085
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
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.