
DLookup with multiple criteria A97
Quote:
>Hi Folks
>Any offers on how to apply syntax DLookup with multiple criteria.
Sure. The third argument to DLookUp (or DMax or DMin or any domain
function) is a valid SQL WHERE clause without the WHERE. One way to
get the syntax is to use the Query grid to create a query which finds
the data that you want to look up; go into SQL view and see it.
You'll then need to build this SQL string up from its components - if
the query references form controls, for instance, you will want to
concatenate their values into the DLookUp third argument rather than
their names:
DLookUp("[LastName]", "[tblPersonnel]", "[DepartmentID] = " &
Forms!myform!cboDepartmentID & " AND [Position] IN ('Manager',
'Foreman', 'High Muck-a-Muck') AND HireDate < #" &
Forms!myform!txtHiredBefore & "#")
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public