470,648 Members | 1,562 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

Wildcards with Like in Microsoft Access

Hi all,

I'm trying a very simple Like statement in MS Access XP, but it's
acting strange. I've always used a percent (%) for wildcards in MS
SQL, and I thought this was the same in MS Access... but I'm finding I
must use an astrisk (*) instead.

Example, with the following layout for Accounts table:
Text AcctNumber (Primary Key)
Text FirstName
Text LastName
Date AdmitDate
Number AmountDue

I use the following statement:
select * from Accounts where lastname like '%th'
.... it returns nothing, but the following statement
select * from Accounts where lastname like '*th'
Does work, returning Smith and others that end in 'th'.

So, in MS Access is a wildcard * instead of % ??? Just checking.

Thanks,

Alex.
Nov 12 '05 #1
2 3673
On 1 Apr 2004 08:48:54 -0800, Alex wrote:
Hi all,

I'm trying a very simple Like statement in MS Access XP, but it's
acting strange. I've always used a percent (%) for wildcards in MS
SQL, and I thought this was the same in MS Access... but I'm finding I
must use an astrisk (*) instead.

Example, with the following layout for Accounts table:
Text AcctNumber (Primary Key)
Text FirstName
Text LastName
Date AdmitDate
Number AmountDue

I use the following statement:
select * from Accounts where lastname like '%th'
... it returns nothing, but the following statement
select * from Accounts where lastname like '*th'
Does work, returning Smith and others that end in 'th'.

So, in MS Access is a wildcard * instead of % ??? Just checking.

Thanks,

Alex.


Yup.
Like "*" & [Enter search word] & "*"
will prompt for, and find all words with the entered word any where in
the field.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #2
"fredg" <fg******@example.invalid> wrote in message
news:8p***************************@40tude.net...
On 1 Apr 2004 08:48:54 -0800, Alex wrote:
So, in MS Access is a wildcard * instead of % ??? Just checking.


Yup.
Like "*" & [Enter search word] & "*"
will prompt for, and find all words with the entered word any where in
the field.


Unless you're using ADO, in which case it's %...

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by DotNetJunkies User | last post: by
2 posts views Thread by Dennis | last post: by
3 posts views Thread by keri | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.