DLOOKUP can't get it to work...

  • Thread starter Thread starter Manuel
  • Start date Start date
M

Manuel

I'm trying to use the function DLookUp so when I enter an
information in a field another field is automatically
entered.
EX: when i enter the job number field in the form, I want
for job location to be automatically filled. I tried this
but nothing happens:

=DLookUp(" [Job Location] ","Job Control"," [Job Number]
= ' " & [Forms]![PO Log Data Entry]![Job Number] & " ' ")

Job Number is a text field that only accepts numbers.
Job Control is a table from where the job location is.

And is [Forms] the correct way to call the forms section
to retrieve the form PO Log Data Entry?

I entered this function in the control source of the text
box, is this the correct way to do it?

help please!
 
Too many spaces, mising quotes and brackets in the wrong
places... try this...

=DLookUp("Job Location","Job Control","[Job Number]
= '" & Forms![PO Log Data Entry]![Job Number] & "'")

-----Original Message-----
-----Original Message-----
Went back and looked at my Dlookup to double check. I am
using it exactly in the same manner as you (and it
actually works). The major diff I see is that I do not
have brackets either around the word "Forms" or the
end "Job Number" before your last ampersand. Be extremely
careful with typing and spaces or Access will just sit
there and look at you.

--------------------------------------
John:
I tried what you wrote down:

=DLookUp("[Job Location]",[Job Control],"[Job Number]
= ' " & Forms ! [PO Log Data Entry] ! Job Number & " ' ")

but this gives me an invalid syntax error, some sort of
comma missing or added.

Is this the coorect way?
.
 
John:

Try:
Dim strJobLoc A
strJobLoc = Nz(DLookUp("[Job Location]",[Job Control],"[Job Number] > = ' "
& Str(Form_PO_Log_Data_Entry.Controls("Job Number).Value) & " ' "),"")

Bill Skeen
(e-mail address removed)
 
John:
Sorry - new keyboard here - typos...

Dim strJobLoc AS String
strJobLoc = Nz(DLookUp("[Job Location]", [Job Control], "[Job Number] > = '
" _
& Form_PO_Log_Data_Entry.Controls("Job
Number).Value & " ' "), "")

Bill Skeen

(e-mail address removed)
 
Back
Top