Dlookup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When using Dlookup are you allowed to have multiple criteria

for instance

ProdEng = DLookup("[Product Engineer]", "EPS Information", "[EPS Number]=" & ProjNum And "[EPS Revison]=" & EPSRev

if this isn't allowed, what can I do to retrieve information from a table based on criteria in two distinct fields???
 
Daniel said:
When using Dlookup are you allowed to have multiple criteria?
for instance:

ProdEng = DLookup("[Product Engineer]", "EPS Information", "[EPS Number]=" & ProjNum And "[EPS Revison]=" & EPSRev)

It IS allowed but you should put the 'and' inside the quotes. Of course,
I daresay.
 
Let me explain a little more.

I have a table that contain the info for all my EPS Revision for exampl

EPS Rev Product Enginee
A P01 Bub
A R01 Mom
B P01 To

I'm need to get the value of the "Product Engineer" that is associated with a specific EPS and Revisio

If I enter EPS A and Rev P01 I want it to return the value "Bubu". How do I do this in VBA? so that I can use "Bubu" elsewhere?
 
When using Dlookup are you allowed to have multiple criteria?

for instance:

ProdEng = DLookup("[Product Engineer]", "EPS Information", "[EPS Number]=" & ProjNum And "[EPS Revison]=" & EPSRev)

if this isn't allowed, what can I do to retrieve information from a table based on criteria in two distinct fields???

Sure, the criteria argument is like the WHERE clause of an SQL
statement. Make sure you have things quoted correctly.

ProdEng = DLookup("[Product Engineer]", "EPS Information", "[EPS
Number]='" & Me.ProjNum & "' And [EPS Revison]=" & Me.EPSRev)

The above assumes a text value for ProjNum and a numeric value for
EPSRev - change to suit your purposes.

- Jim
 
Let me explain a little more..

I have a table that contain the info for all my EPS Revision for example

EPS Rev Product Engineer
A P01 Bubu
A R01 Momo
B P01 Tom

I'm need to get the value of the "Product Engineer" that is associated with a specific EPS and Revision

If I enter EPS A and Rev P01 I want it to return the value "Bubu". How do I do this in VBA? so that I can use "Bubu" elsewhere?

If on your form's recordset ProjNum means EPS and EPSRev means Rev
then this should do it.

ProdEng = DLookup("[Product Engineer]", "EPS Information", "EPS='" &
Me.ProjNum & "' And Rev='" & Me.EPSRev & "'")

- Jim
 
This may be a really stupid question but can you explain why the added quotes??? Or where can I get some info on proper synthax

Thanks

Daniel
 
Back
Top