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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookUp

Status
Not open for further replies.

pbrown77

Technical User
Feb 21, 2005
55
US
I know that I can use DLookUp when I am looking up something when based off of one item but I need to do it based off two.

Below there are 3 fields involved.
1) DST
2) Make
3) Zone

What I need is for the zone to be automatically filled in based off of the value in DST and Make. Several DST can be in the same zone, but only 1 zone will match if DST and Make is used. I.E. DST = Incorrect Padding on upper wall. Well the zone could be 2, 4 or 8. But if Make = T then the only possible zone is 4. So I need to use two criterias in the DLookUp. Is this possible or does anyone have another suggestion?

Dim strCC As String
strCC = DLookup("[CCS]", "Element Table", "[Element table]![Element Description]=[forms]![Cause-Defect]![DST]" And "[Element table]![Make]=[forms]![Cause-Defect]![Make]")
Me.ZONE = strCC
 
strCC = DLookup("CCS", "[Element Table]", "[Element Description]=[tt]'"[/tt] & Forms![Cause-Defect]!DST & [tt]"'[/tt] AND Make=[tt]'"[/tt] & Forms![Cause-Defect]!Make & [tt]"'"[/tt])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Is Element Description a number or text?
Is Make a number or text?

This assumes both are text:

strCC = DLookup("[CCS]", "Element Table", "[Element Description] = '" & [forms]![Cause-Defect]![DST] & "' and [Make] = '" & [forms]![Cause-Defect]![Make] & "'")


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top