Dlookup error stating #Error

  • Thread starter Thread starter lpl.peldred
  • Start date Start date
L

lpl.peldred

Hi,
In my Access 2003 database, I have a table called Trade Routings. This
table contains the fields Trade and Sales Contact, both text fields.

In a form called FormTransDetail I have a field called Trade that has
a row source linked to the Trade field in table Trade Routings.

I then want to look up the Sales Contact field based on the contents
of the field Trade and have used the expression below. For some reason
it keeps coming up with #Error instead of the field contents.

=DLookUp("[Sales Contact]","[Trade routings]","[Trade routings]!
[Trade] =" & Forms.FormTransDetail.Trade)

What am I doing wrong?

Thanks
Paul
 
Text fields need to be enclosed by single apostrophes
=DLookUp("[Sales Contact]","[Trade routings]","[Trade] = '" &
Forms.FormTransDetail.Trade & "'")
 
Hi,
In my Access 2003 database, I have a table called Trade Routings. This
table contains the fields Trade and Sales Contact, both text fields.

In a form called FormTransDetail I have a field called Trade that has
a row source linked to the Trade field in table Trade Routings.

I then want to look up the Sales Contact field based on the contents
of the field Trade and have used the expression below. For some reason
it keeps coming up with #Error instead of the field contents.

=DLookUp("[Sales Contact]","[Trade routings]","[Trade routings]!
[Trade] =" & Forms.FormTransDetail.Trade)

What am I doing wrong?

Thanks
Paul

Perfect, used;
=DLookUp("[Sales Contact]","[Trade routings]","[Trade] =" & "'" &
Forms.FormTransDetail.Trade & "'")

Thanks very much.
Paul
 
Back
Top