DLookup

G

Guest

For some reason, I'm not able to make the DLookup function work. I have a table that holds CC (text) and Title (Text). I have a query that feeds a form that has an unbound text box. The Control Source for that box is as follows
=DLookUp("[Title]","[class code descriptions]","[CC] = ' " & [Me]![CC] & " ' "

I want the form to update the underlying table with CC and Title

It doesn't work. There is no Error, but when viewing the form, that box has "#name?" in it. I've tried moving the quotes, removing them, moving the "&", removing the "&". I'm at my wits end

Thanks in advance
 
C

Chris

What happens when you go to the debug window (Ctrl-G) and
copy that code? Replace Me!CC with a real value.

I would guess that you have spelled the name wrong of one
of the tables/fields.

Also, get ride of the spaces before and after the single-
quotes.


=DLookUp("[Title]","[class code descriptions]","[CC] = '"
& [Me]![CC] & "'")

-----Original Message-----
For some reason, I'm not able to make the DLookup
function work. I have a table that holds CC (text) and
Title (Text). I have a query that feeds a form that has
an unbound text box. The Control Source for that box is
as follows:
=DLookUp("[Title]","[class code descriptions]","[CC] = ' " & [Me]![CC] & " ' ")

I want the form to update the underlying table with CC and Title.

It doesn't work. There is no Error, but when viewing the
form, that box has "#name?" in it. I've tried moving the
quotes, removing them, moving the "&", removing the "&".
I'm at my wits end.
 
W

Wayne Morgan

"Me" won't work in a Control Source, try removing the "Me!". Also, I don't
know if you did it for reading clarity or if you really have it that way,
but you don't need the spaces between the single and double quotes. I
haven't tested it to see if this will cause a problem or not.

Are there any apostrophes (') in the text in the field CC (i.e. last names
such as O'Hare)? If so, you'll need to change the quotes setup because this
will mess up the use of single quotes.

--
Wayne Morgan
Microsoft Access MVP


JLM said:
For some reason, I'm not able to make the DLookup function work. I have a
table that holds CC (text) and Title (Text). I have a query that feeds a
form that has an unbound text box. The Control Source for that box is as
follows:
=DLookUp("[Title]","[class code descriptions]","[CC] = ' " & [Me]![CC] & " ' ")

I want the form to update the underlying table with CC and Title.

It doesn't work. There is no Error, but when viewing the form, that box
has "#name?" in it. I've tried moving the quotes, removing them, moving the
"&", removing the "&". I'm at my wits end.
 
P

Pjf

Try removing the brackets [ ] , since there are no spaces in the field
names they are not necessary and access (I believe) thinks that they're part
of the name. They should not be included in the source class code
description , either since this is the string name of the table, and never
around Me

try this

dlookup ("Title","class code description", "CC = '" & me!cc & "'")

you may have to refresh the form too.
JLM said:
For some reason, I'm not able to make the DLookup function work. I have a
table that holds CC (text) and Title (Text). I have a query that feeds a
form that has an unbound text box. The Control Source for that box is as
follows:
=DLookUp("[Title]","[class code descriptions]","[CC] = ' " & [Me]![CC] & " ' ")

I want the form to update the underlying table with CC and Title.

It doesn't work. There is no Error, but when viewing the form, that box
has "#name?" in it. I've tried moving the quotes, removing them, moving the
"&", removing the "&". I'm at my wits end.
 

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

Similar Threads


Top