Microsoft Office Tutorials and References
In Depth Information
Testing for Empty Fields
Testing for Empty Fields
Sometimes, having an expression know whether a field is empty, or null,
is useful. Access includes an IsNull() function that you can use to test
whether a field is empty. The syntax of the function is pretty straightforward:
IsNull([ fieldname ])
fieldname is the name of the field you want to test.
If the specified field is empty, IsNull() returns a True value. If the
specified field isn’t empty, IsNull() returns a False value. The next section
provides an example of using IsNull() in an expression.
To treat a null field as a zero in mathematical expressions, use the Nz()
function, described in the section “Avoiding problems with null values,”
earlier in this chapter.
Sorting by Name or Company
A fairly common problem comes up in tables that store names and
addresses. Some records in such a table may list a person’s name but no
company name; other records may contain a company name but no person’s
name. If you sort records in such a table by the Last Name, First Name,
and Company fields, as in Figure 2-12, the records with empty Last Name
and First Name fields are listed first.
Figure 2-12:
Sorting by
name and
company
fields puts
empty name
fields at the
top.
Search JabSto ::




Custom Search