Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup for two values

Status
Not open for further replies.

mvtjd

Technical User
Nov 27, 2001
5
0
0
US
Is there a way to execute a Dlookup command based on two values?

The current command is:
Forms![frmUserEntry]![DefectDescription] = DLookup("[DefectDescription]", "Tbltotaltestdata", "[MeasurementName] = Forms![frmUserEntry]!MeasurementName")

The name of the field that I need to add is called CKPCode1. To clarify I need the lookup to be based on the two values of CKPCode1 and MeasurementName at the same time.
 
You just need to build a lareger Where part of the Dlookup:

Forms![frmUserEntry]![DefectDescription] = DLookup("[DefectDescription]", "Tbltotaltestdata", "[MeasurementName] = '" & Forms![frmUserEntry]![MeasurementName] & "' and [CKPCode1] in ('X','Y')")

You also neede to have quotes around the Measurementname variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top