DLookUp quick problem

  • Thread starter Thread starter francisco
  • Start date Start date
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?
 
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])
 
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])
 
Back
Top