Filter also is a wildcard

A

AccessIM

I have a name field that includes an asterisk if the employee is part-time
(i.e. John Doe*). I would like to filter out only these employees but I
don't know how to write the criteria since the asterisk is also a wildcard
character.

Is this even possible to do? Thank you in advance.
 
S

Sylvain Lafontaine

For Access, use the list symbol if you want to search for * as an ordinary
character (when not using the ANSI-92 compatible syntax):

.... Where Texte1 Like "*[*]*"


See http://articles.techrepublic.com.com/5100-10878_11-6154704.html for
other tips on using the LIKE operator for Access. Other possibilities would
be to use the ALIKE operator - which always use the ANSI-92 specification
instead of the ANSI-89 - or to use a string searching function:

.... WHERE Text1 ALike "%*%"

.... WHERE InStr (Texte1, "*") > 0

.... WHERE len (Texte1) <> len (Replace (Texte1 , "*", ""))

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
 
F

fredg

I have a name field that includes an asterisk if the employee is part-time
(i.e. John Doe*). I would like to filter out only these employees but I
don't know how to write the criteria since the asterisk is also a wildcard
character.

Is this even possible to do? Thank you in advance.

Like "*[*]*"
will find asterisks anywhere in the field.

Or if you just wish records with the asterisk at the end of the field:
Like "*[*]"
 
M

Marshall Barton

AccessIM said:
I have a name field that includes an asterisk if the employee is part-time
(i.e. John Doe*). I would like to filter out only these employees but I
don't know how to write the criteria since the asterisk is also a wildcard
character.


Put it in [ ]

Like "*[*]"
 
A

AccessIM

Thank you all. That worked like a charm.

Sylvain Lafontaine said:
For Access, use the list symbol if you want to search for * as an ordinary
character (when not using the ANSI-92 compatible syntax):

.... Where Texte1 Like "*[*]*"


See http://articles.techrepublic.com.com/5100-10878_11-6154704.html for
other tips on using the LIKE operator for Access. Other possibilities would
be to use the ALIKE operator - which always use the ANSI-92 specification
instead of the ANSI-89 - or to use a string searching function:

.... WHERE Text1 ALike "%*%"

.... WHERE InStr (Texte1, "*") > 0

.... WHERE len (Texte1) <> len (Replace (Texte1 , "*", ""))

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


AccessIM said:
I have a name field that includes an asterisk if the employee is part-time
(i.e. John Doe*). I would like to filter out only these employees but I
don't know how to write the criteria since the asterisk is also a wildcard
character.

Is this even possible to do? Thank you in advance.
 

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