DLookUp quick problem

F

francisco

I have this problem I have a DLookUp function that calls a
[Job Location]from the "Job Control" when the [Job Number]
is chosen:

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

I did work, but then I changed the [Job Number] from text
to a number field type. and now it says it has an error.
Why? Can anybody help?
 
W

Wayne Morgan

If the value is now a number, you don't need the single quotes.

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

Rick Brandt

francisco said:
Thanks for the advice, it worked, but the item will not
save the job location in the [PO Log] table, that's where
the form comes from.
How can I do this?

If the Job Number only has one location then there is no reason to store it again.
Using the Dlookup (or other lookup method) to *display* the related information is
the proper way to do it.

If you insist on storing it redundantly, you would change the ControlSource so it
points to the field in your table and use the AfterUpdate event of the Job Number to
do the lookup in code and "plug in" that value to the bound control.

Me![Job Location] = DLookUp("[Job Location]","Job Control","[Job Number] = " &
Me![Job Number])
 

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

Top