DLookup with multiple fields
public text v1 · immutableDim CustID As String
Dim EmpID As Long
Dim Result
CustID = "SIMOB"
EmpID = 2
Result = DLookup("[OrderID]", "Orders", _
"[CustomerID] = '" & CustID & "' And [EmployeeID] = " & EmpID)
MsgBox Result
'NOTE: If the DLookup() function is unsuccessful, the variable Result contains a null.
'NOTE: The criteria is made up of four pieces that are evaluated individually.
'NOTE: The results are appended, then evaluated as a whole.