Dlookup won't work - help

G

Guest

I have 2 tables set up.

First one is called tblcustomers with primary key field called customer
account code.

Second one is called tbllookup also with primary key called customer account
code but with address, city and other fields.

I created a query called qryquote and added these two tables and the
customer account code field from tblcustomers. What I want to do is be able
to enter a customer code which populates the customer account code field in
the tblcustomers table and it automatically fills in the address, city etc
from the lookup table. I created a calculated field called Address in my
query as follows but it doesn't work:

Address: DLookUp(" [address] ","[tbllookup]","[customer account
code]"="[tblcustomers]"."[customer account code]")

Any help appreciated - PS - I'm useless with code so any help with the above
function gratefully received.

Thanks

Anita
 
T

Tom Lake

Anita said:
I have 2 tables set up.

First one is called tblcustomers with primary key field called customer
account code.

Second one is called tbllookup also with primary key called customer
account
code but with address, city and other fields.

I created a query called qryquote and added these two tables and the
customer account code field from tblcustomers. What I want to do is be
able
to enter a customer code which populates the customer account code field
in
the tblcustomers table and it automatically fills in the address, city etc
from the lookup table. I created a calculated field called Address in my
query as follows but it doesn't work:

Address: DLookUp(" [address] ","[tbllookup]","[customer account
code]"="[tblcustomers]"."[customer account code]")

Any help appreciated - PS - I'm useless with code so any help with the
above
function gratefully received.

Address: DLookUp("[address]","[tbllookup]","[customer account code]='" &
[tblcustomers].[customer account code] & "'"")

Try the above

Tom Lake
 
G

Guest

It says the expression you entered has an invalid string and it seems to
select the last quotes at the end of the expression. Also, I do not
understand the & and quotes - I think it has something to do with text but
would appreciate any help so that I can get my head round it !

Thanks for your help.


Tom Lake said:
Anita said:
I have 2 tables set up.

First one is called tblcustomers with primary key field called customer
account code.

Second one is called tbllookup also with primary key called customer
account
code but with address, city and other fields.

I created a query called qryquote and added these two tables and the
customer account code field from tblcustomers. What I want to do is be
able
to enter a customer code which populates the customer account code field
in
the tblcustomers table and it automatically fills in the address, city etc
from the lookup table. I created a calculated field called Address in my
query as follows but it doesn't work:

Address: DLookUp(" [address] ","[tbllookup]","[customer account
code]"="[tblcustomers]"."[customer account code]")

Any help appreciated - PS - I'm useless with code so any help with the
above
function gratefully received.

Address: DLookUp("[address]","[tbllookup]","[customer account code]='" &
[tblcustomers].[customer account code] & "'"")

Try the above

Tom Lake
 
F

fredg

It says the expression you entered has an invalid string and it seems to
select the last quotes at the end of the expression. Also, I do not
understand the & and quotes - I think it has something to do with text but
would appreciate any help so that I can get my head round it !

Thanks for your help.

Tom Lake said:
Anita said:
I have 2 tables set up.

First one is called tblcustomers with primary key field called customer
account code.

Second one is called tbllookup also with primary key called customer
account
code but with address, city and other fields.

I created a query called qryquote and added these two tables and the
customer account code field from tblcustomers. What I want to do is be
able
to enter a customer code which populates the customer account code field
in
the tblcustomers table and it automatically fills in the address, city etc
from the lookup table. I created a calculated field called Address in my
query as follows but it doesn't work:

Address: DLookUp(" [address] ","[tbllookup]","[customer account
code]"="[tblcustomers]"."[customer account code]")

Any help appreciated - PS - I'm useless with code so any help with the
above
function gratefully received.

Address: DLookUp("[address]","[tbllookup]","[customer account code]='" &
[tblcustomers].[customer account code] & "'"")

Try the above

Tom Lake

You never did mention what the datatype is of [Customer Account Code].
If that field is Text datatype, then:

Address: DLookUp("[address]","[tbllookup]","[customer account code]='"
& [customer account code] & "'")
should work. Just for clarity, the quotes are:
"[customer account code]=' " & [customer account code] & " ' ")

However, if [Customer Account Code] is a Number datatype, then use:
Address: DLookUp("[address]","[tbllookup]","[customer account code]="
& [customer account code])
 

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