Link to home
Start Free TrialLog in
Avatar of QualityEng
QualityEng

asked on

Having trouble with Dlookup

I am running Access 2010 and would like to auto populate text into a number of cells on a form a OBDC connection.  I have the connection setup and seems to work fine.  I have input the following into a text box (Source Control)

=DLookUp("[Customer]"," [dbo_Job]","[Job]= ' " & [Forms]![Printable CoC Form]![Job] & " ' ")

I have tried a number similar permutation but haven't got it to work.

Thank you for you assistance.
Avatar of Mike Eghtebas
Mike Eghtebas
Flag of United States of America image

=DLookUp("[Customer]"," [dbo_Job]","[Job]= " & char(34) & [Forms]![Printable CoC Form]![Job] & char(34) )

Open in new window

Avatar of QualityEng
QualityEng

ASKER

Thanks Mike but it didn't work.  Any other idea?  I feel like I am missing something fundamental.User generated image
Avatar of Rey Obrero (Capricorn1)
try this,
if field [job] is Number Data type

=DLookUp("Customer","dbo_Job","[Job]= " & [Forms]![Printable CoC Form]![Job])


if field [job] is Text Data type

=DLookUp("Customer","dbo_Job","[Job]= '" & [Forms]![Printable CoC Form]![Job] & "'")
If job# is a numeric, it needs to be:

=DLookUp("[Customer]"," [dbo_Job]","[Job]=" & [Forms]![Printable CoC Form]![Job])

also in that second screen shot, second Dlookup has :

[Sales Order#:]=

 as part of the 3rd argument.

You want the name of the field only.  Hopefully, that really doesn't contain spaces and the colon in it.

See your "next door" too (somewhat). ...I'm in Syracuse.

Jim.
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have too many spaces:

=DLookUp("[Customer]"," [dbo_Job]","[Job]= ' " & [Forms]![Printable CoC Form]![Job] & " ' ")

Use:

=DLookUp("[Customer]","[dbo_Job]","[Job] = '" & [Forms]![Printable CoC Form]![Job] & "'")

/gustav
Thank you giving me solution that i did not ask for.  It really better and in hindsight a obvious solution.