Dlookup is driving me crazy !! Please help !

  • Thread starter Thread starter david
  • Start date Start date
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
 
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.
 
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
 
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?
 
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
 
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
 
Back
Top