Dlookup is driving me crazy !! Please help !

D

david

Hi everybody ,

I am having a hard time with the Dlookup function , I think the syntax I am
using correct but ever since I run the code ,access is telling me there is
something wrong " the expression syntax is incorrect" .
My syntax is : =DLookup("[Company]", "User", "[Name] = 'Test'")
I have been on many websites which all says that my syntax is correct ! But
still !

Has anybody experienced something like this ?

Many thanks
 
R

Rick Brandt

david said:
Hi everybody ,

I am having a hard time with the Dlookup function , I think the syntax I am
using correct but ever since I run the code ,access is telling me there is
something wrong " the expression syntax is incorrect" .
My syntax is : =DLookup("[Company]", "User", "[Name] = 'Test'")
I have been on many websites which all says that my syntax is correct ! But
still !

You might need to check your references. I created a test table with these field
names and copied your expression exactly. Worked just fine. "Name" is a bad name
for a field though as this is can easily get confused with the property "Name". The
square brackets usually take care of that though.
 
F

Fredg

David,
Regarding your use of Name as a field name, please take a look at one of
these Microsoft KnowledgeBase articles:

109312 'Reserved Words in Microsoft Access'
209187 'Acc2000: 'Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
Remove nothing from my address
 
J

John Vinson

Hi everybody ,

I am having a hard time with the Dlookup function , I think the syntax I am
using correct but ever since I run the code ,access is telling me there is
something wrong " the expression syntax is incorrect" .
My syntax is : =DLookup("[Company]", "User", "[Name] = 'Test'")
I have been on many websites which all says that my syntax is correct ! But
still !

Do you have a Table named User, with fields named [Name] and
[Company]? What is the context of this expression - where are you
using it?
 
H

Hugh O'Neill

david said:
Hi everybody ,

I am having a hard time with the Dlookup function , I think the
syntax I am using correct but ever since I run the code ,access is
telling me there is something wrong " the expression syntax is
incorrect" . My syntax is : =DLookup("[Company]", "User", "[Name] =
'Test'") I have been on many websites which all says that my syntax
is correct ! But still !

Has anybody experienced something like this ?

Many thanks


You might want to change [Name] to something else as the word 'name' is
a reserved word in Access, so you shouldn't use it yourself.

hth

Hugh
 
R

Rick Brandt

Where? He has single quotes around his string value and double quotes around
the argument.


Paul Overway said:
You have an unneeded apostrophe after Test

--
Paul Overway
Logico Solutions, LLC
www.logico-solutions.com


david said:
Hi everybody ,

I am having a hard time with the Dlookup function , I think the syntax I am
using correct but ever since I run the code ,access is telling me there is
something wrong " the expression syntax is incorrect" .
My syntax is : =DLookup("[Company]", "User", "[Name] = 'Test'")
I have been on many websites which all says that my syntax is correct ! But
still !

Has anybody experienced something like this ?

Many thanks
 

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