"Like"

G

Guest

When I enter the keyword "Like" in the criteria row of a query the
application changes the word to "ALike" when I run the query or move off the
field. It returns zero records.

The SQL window shows "ALike". When I try to correct it in the SQL window to
"Like" and run the query the application changes it back to "ALike".

I scanned for viruses and checked autospeller.
 
D

Dirk Goldgar

Steve Zabriski said:
When I enter the keyword "Like" in the criteria row of a query the
application changes the word to "ALike" when I run the query or move
off the field. It returns zero records.

The SQL window shows "ALike". When I try to correct it in the SQL
window to "Like" and run the query the application changes it back to
"ALike".

I scanned for viruses and checked autospeller.

Do you have the "SQL Server Compatible Syntax (ANSI 92)" option checked,
on the Tables/Queries tab of the Tools -> Options... dialog?
 
G

Guest

Yes, this database and as the default.

Dirk Goldgar said:
Do you have the "SQL Server Compatible Syntax (ANSI 92)" option checked,
on the Tables/Queries tab of the Tools -> Options... dialog?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
J

John Vinson

When I enter the keyword "Like" in the criteria row of a query the
application changes the word to "ALike" when I run the query or move off the
field. It returns zero records.

The SQL window shows "ALike". When I try to correct it in the SQL window to
"Like" and run the query the application changes it back to "ALike".

I scanned for viruses and checked autospeller.

Check - and turn off - Name Autocorrect. Also take a look at Tools...
Options... Spelling... Autocorrect Options; turn off "correct spelling
as you type".

John W. Vinson[MVP]
 
D

Dirk Goldgar

Steve Zabriski said:
Yes, this database and as the default.

Although I haven't seen documentation of this behavior, I've observed
that, whenever you have ANSI 92 query syntax turned on, Access
automatically transforms Like to ALike. In ANSI 92 syntax, the common
Jet wildcard characters '*' and '?', as used by the Like operator, are
replaced by '%' and '_'. The ALike operator enforces this replacement:
it always uses the ANSI 92 wildcard characters, regardless of whether
you have ANSI 92 syntax turned on or not. I think Access probably
forces Like to ALike with the intention of increasing the portability of
the queries written using these wildcard characters (since the pattern
matching will be the same even if you later change back to the older,
standard Jet syntax).

If you want to use Like, with the '*' and '?' wildcards, you'll find it
easiest to uncheck the ANSI 92 Syntax option. Otherwise, you may as
well get used to using ALike and the ANSI 92 wildcards.
 

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