DLOOKUP can't get it to work...

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!
 
S

SnoopyDawg

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?
.
 
W

William P Skeen

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)
 
W

William P Skeen

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DLookUp 1
DLookUp quick problem 3
Trying to use DLookup 3
Enter/Display Many side 2
DLookup syntax 6
Default Value for a Text box field 1
Linking Subforms 3
dlookup in subform not working 8

Top