Hi cansoft,
If I understand correctly...
I *think* John meant your WHERE clause would be like
(replace "yurfield" with actual name of field):
WHERE
(
[yurfield] LIKE
"*" & [Forms]![Purchase Orders(inventory)]![LookFilt1] & "*"
)
OR
(
[Forms]![Purchase Orders(inventory)]![LookFilt1] IS NULL
);
The "yurfield" does not participate in the last part of OR...
FYI
WHERE [yurfield] LIKE "*"
works exactly as you describe (so good to remember)
-- it ignores all records where "yurfield" is null
Also, unless you can rest assured that your
users will not possibly enter [SPACE](s),
here may be a more robust variation:
WHERE
(
[yurfield] LIKE
"*" & [Forms]![Purchase Orders(inventory)]![LookFilt1] & "*"
)
OR
(
Len(Trim([Forms]![Purchase Orders(inventory)]![LookFilt1] & ""))=0
);
good luck,
gary
cansoft said:
Thanks John. But that solution does not produce the desired effect.
When LookFilt1 is null then the correct records are selected (all records)
However when LookFilt1 contains a string, records containing the string
are
selected as well as records that are null. I would like to select only
records containing the string when LookFilt1 contains a string and all
records when LookFilt1 is null.
John W. Vinson said:
On Thu, 4 Oct 2007 15:25:01 -0700, cansoft
<
[email protected]>
wrote:
If LookFilt1 contains a string the filter works and displays all records
containing the string.
If LookFilt1 is null then Access displays all records except records
with
null values in the field.
How do I get Access to display all records when LookFilt1 is null??
Try:
LIKE "*" & [Forms]![Purchase Orders(inventory)]![LookFilt1] & "*" OR IS
NULL
John W. Vinson [MVP]