Note that the same logic applies to most Domain Aggregate Functions
(DMax, DMin etc.)
Normal usage
For numerical values:
DLookup("FieldName" , "TableName" , "Criteria = n")
For strings: (note the apostrophe before and after the value)
DLookup("FieldName" , "TableName" , "Criteria= 'string'")
For dates:
DLookup("FieldName" , "TableName" , "Criteria= #date#")
Refering to a form control
For numerical values:
DLookup("FieldName", "TableName", "Criteria = " & forms!FormName!ControlName)
For strings: (note the apostrophe before and after the value)
DLookup("FieldName", "TableName", "Criteria = '" & forms!FormName!ControlName & "'")
dates:
DLookup("FieldName", "TableName", "Criteria = #" & forms!FormName!ControlName & "#")
Mix-n-Match
DLookup("FieldName", "TableName", "Criteria1 = " & Forms!FormName!Control1 _
& " AND Criteria2 = '" & Forms!FormName!Control2 & "'" _
& " AND Criteria3 =#" & Forms!FormName!Control3 & "#")
|