Steve said:
Keven,
This is not correct. If a text field contains a zero-length string ""
then a criteria of 'Is Null' will not find it. But if the text field is
Null, then a criteria of "" will not find it, and a criteria of 'Is
Null' will.
It is therefore important to distinguish between Null and ZLS. Allen
Browne has a good article at
http://www.everythingaccess.com/tut...n-Nothing,-Empty,-Missing,-Null,-Zero-and-ZLS
which may help you to understand it better.
What you say is true, but watch out for the following 'gotcha':
In:
http://groups.google.com/group/microsoft.public.access/msg/280e6d26122b3cd7
I wrote:
PARAMETERS Forms!frmSelect!txtName.Value Text,
Forms!frmSelect!cboDeliverable.Value Text;
SELECT tblDepts.DeptID, tblDepts.[Department Name], tblUse.Status,
tblUse.Deliverable FROM tblDepts LEFT JOIN tblUse ON tblDepts.DeptID =
tblUse.DeptID
WHERE IIf(Forms!frmSelect!txtName.Value = "", True, tblDepts.[Department
Name] = Forms!frmSelect!txtName.Value) AND
IIf(Forms!frmSelect!cboDeliverable.Value = "", True,
tblDepts.[Department Name] = Forms!frmSelect!cboDeliverable.Value);
Without the PARAMETERS line, if the value of
Forms!frmSelect!txtName.Value is blank, then
IsNull(Forms!frmSelect!txtName.Value) in a query returns -1. If the
PARAMETERS line is added without changing the rest of the query, then
IsNull(Forms!frmSelect!txtName.Value), or even
'Forms!frmSelect!txtName.Value IS NULL', returns 0, even though there is
no value specified in the textbox. Therefore, using
IIf(Forms!frmSelect!txtName.Value IS NULL, True, ... in the SQL above
will cause the detection of a blank textbox on a form to be incorrect.
James A. Fortune
(e-mail address removed)