Filter also is a wildcard

  • Thread starter Thread starter AccessIM
  • Start date Start date
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.
 
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)
 
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 "*[*]"
 
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 "*[*]"
 
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.
 
Back
Top