Where clause is not working

  • Thread starter jatin chaturvedi
  • Start date
J

jatin chaturvedi

I am using MS Access 2007. I am getting syntax error when I run this query

Select 2A.* from 2A where 2A.[Name]= 'Jatin';


when I run query below, It gives all the result i.e. where clause is not working.

Select 2A.* from 2A where '2A.[Name]= Jatin';

Please help



EggHeadCafe - Software Developer Portal of Choice
Build a C# NotifyIcon BalloonTip Scheduled Outlook Mail Checker
http://www.eggheadcafe.com/tutorial...ef-7dd29b6ae909/build-a-c-notifyicon-bal.aspx
 
A

Allen Browne

Suggestions:

a) Add a square bracket around any names that start with a digit e.g.
[2A]
That's the reason for the syntax error.

b) Your 2nd example has the quote mark in the wrong place. Everything inside
quotes resolves to a non-zero value, which is treated as True. Since the
WHERE clause evaluates to True (regardless of the record), all records are
returned.

c) Avoid using Name as a field name in Access. Most objects (forms, reports,
....) have a Name property, and Access gets confused about what you mean.
Consider renaming the field to something else and see if it works. Here's a
list of the words to avoid:
http://allenbrowne.com/AppIssueBadWord.html#N

d) Before renaming the field, ensure that Name AutoCorrect is off.
http://allenbrowne.com/bug-03.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.


in message news:[email protected]...
 

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