The syntax for the
DLookup() function is a follows:
DLookup(expr, domain, [criteria])
The
DLookup() function returns a value from a field in a specified set of records called the domain. The
DLookup() function specifies the criteria for the domain. To make the domain dependent on one or more values listed in controls on a form or report, refer to the controls in the
DLookup() criteria argument.
The following example looks in the Employees table (the domain) and
returns the Last Name of the Employee ID specified in the [ControlName]
control on the form.
NOTE: In the following example, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this example.
=DLookup("[LastName]", "Employees", "[EmployeeID] = " & _
Forms![FormName]![ControlName])
DLookup() returns one value from a single field even if more than one record satisfies the criteria. If no record satisfies the criteria or if the domain contains no records,
DLookup() returns
Null.