By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,503 Members | 2,821 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,503 IT Pros & Developers. It's quick & easy.

Wildcards with Like in Microsoft Access

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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.