DLOOKUP function problem

CosmaL

Registered User.
Local time
Today, 15:00
Joined
Jan 14, 2010
Messages
94
Dear friends,

i've got the following problem with the dlookup function.

I use the function in a form and report, just to show information about the document.
The problem is that, it always shows me the first record and not the correct value.

I think syntax is ok.

compid is the clients id
key_workArea is the workarea id
key_workPosition is the workposition id

All fields are numerics, except workplace which is string.

=DLookUp("[WorkPlace]";"Document";"[Compid]=" & [compid] And "[Key_workArea]=" & [key_workarea] And "[key_workposition]=" & [key_workPosition])

Any recommendations?

Thank you in advance!

Costis
 
use commas and your ANDs fell outside the string , put them inside:
=DLookUp("[WorkPlace]","Document","[Compid]=" & [compid] & " And [Key_workArea]=" & [key_workarea] & " And [key_workposition]=" & [key_workPosition]
 
Your quote marks were all over the place Try

Code:
=DLookUp("[WorkPlace]";"Document";"[Compid]=" & [compid] & " And [Key_workArea]=" & [key_workarea] &" And [key_workposition]=" & [key_workPosition])

This will only work if all the values in your criteria are numbers.
 
something wrong in your syntax, should be:

=DLookUp("[WorkPlace]";"Document";"[Compid]=" & [compid] & " And [Key_workArea]=" & [key_workarea] & " And [key_workposition]=" & [key_workPosition])

also, qualify it with the form name:

=DLookUp("[WorkPlace]";"Document";"[Compid]=" & Forms!yourForm![compid] & " And [Key_workArea]=" & Forms!yourForm![key_workarea] & " And [key_workposition]=" & Forms!yourForm![key_workPosition])
 
Thanks guys!
It's working great with Minty's directions!!!

Thanks again!!!!!
 
as i mentioned you should qualify it with correct form name, you wouldn't know if you open another form with same control name. since your function is public it will take the control name of whichever form has the current active/focus.
 

Users who are viewing this thread

Back
Top Bottom