"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.