Re: Where clause is not working

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"jatin chaturvedi" wrote in message news:20091113324jchaturv@xxxxxxxxxxxx
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/tutorials/aspnet/0235490b-a901-42b4-9eef-7dd29b6ae909/build-a-c-notifyicon-bal.aspx

.



Relevant Pages

  • Re: When is finally justified?
    ... doesn't finally simply help you avoid ... a finally clause has no reason to exist if there ... it helps you avoid duplicating code." ... or open database connections. ...
    (comp.lang.java.programmer)
  • Re: Rehashing the so that grammar
    ... 'Turn the lantern so | that we may see what is'. ... that completes the first clause adds. ... "It has gotten so that Justus and I avoid the subject around him'. ...
    (alt.usage.english)
  • Re: problem with Year function
    ... subform. ... Is there a work around without renaming the field? ... The best solution would be to rename the field, ... It's best to avoid all kinds of reserved words, ...
    (microsoft.public.access.formscoding)
  • Re: Replacement for Resume Next
    ... > I'm using VS 2005 now and would like to know if .Net has a replacement for ... > the Resume Next clause. ... > GetDirectories throws an exception. ... do you have a reason to avoid the use ...
    (microsoft.public.dotnet.languages.vb)
  • Re: [kvm-devel] [PATCH 02/33] KVM: MMU: emulated cmpxchg8b should be atomic on i386
    ... This is required to avoid a guest ... [avi: make it compile] ... IMHO renaming the parameter variable is probably better in the long run, ...
    (Linux-Kernel)