ALike (1 Viewer)

Stemdriller

Registered User.
Local time
Today, 20:49
Joined
May 29, 2008
Messages
187
I am relatively new to Access but I am just creating my first database for the workplace.

Everything was going to plan until I came up against this.

In a query when I type Like "Blue" in the criteria it changes it to ALike and the query shows nothing.

I have searched and searched and asked but all to no avail. Any suggestions would be greatly appreciated, if I understand what it is I may be able to understand why it's doing it and sort it.

Thanks
 

redneckgeek

New member
Local time
Today, 15:49
Joined
Dec 28, 2007
Messages
464
Never heard of that before:confused:
ALIKE isn't an Access keyword of any kind. Are you using Like "Blue" or Like "*Blue*"?
 

Stemdriller

Registered User.
Local time
Today, 20:49
Joined
May 29, 2008
Messages
187
Like "Blue"
 

redneckgeek

New member
Local time
Today, 15:49
Joined
Dec 28, 2007
Messages
464
Like "Blue" is the same as ="Blue" You have to use a wild card character for Like to what is intended. If you want any instance of the the word "BLUE" in a field, use LIKE "*BLUE*"
 

LPurvis

AWF VIP
Local time
Today, 20:49
Joined
Jun 16, 2008
Messages
1,269
Though it's not actually listed on official lists of Reserved words (I'd suggest that's an oversight) Alike is indeed a keyword in Jet SQL.
It's the ANSI Like - which can be used in either mode of compatibility.
In other words - when you're using Alike you would use the ANSI wildcard (%) instead of Jet's default (*).

So
WHERE FieldName Like 'Smith*'
would be
WHERE FieldName ALike 'Smith%'

The behaviour you're seeing (Like automatically changed to Alike in the QBE - I presume it's the QBE - it wouldn't happen in SQL view.. the parser isn't that pushy) implies that you have your application in ANSI mode. (Whereby it assumes you want to use Alike).
In fact - in that mode
WHERE FieldName Like 'Smith%'
would be valid syntax anyway. It's just going for maximum compatilbility in query writing.

To remove it:
Tools > Options > Tables/Queries > SQL Server Compatible Syntax (ANSI 92)

Knock off the checkbox.

Cheers.
 

Users who are viewing this thread

Top Bottom