What is the correct syntax to search a table for an asterisk

  • Thread starter Thread starter webaddict
  • Start date Start date
W

webaddict

Our Access 2003 db has 2 asterisks placed after the last name and I would
like to remove them from the db. I am hoping that I would not have to do this
by hand as there are over 6,000 entries.

Please advise
 
Our Access 2003 db has 2 asterisks placed after the last name and I would
like to remove them from the db. I am hoping that I would not have to do this
by hand as there are over 6,000 entries.

Please advise

Asked again 10 minutes later and answered in that later thread.

10 minutes is not a long time to wait for a reply to a question.
Please be patient.
Thank you.
 
Webaddict -

Enclose the asterisk in square brackets. For example, to find an asterist
at the end of any string, use this:

like "*[*]"

or anywhere in a string:

like "*[*]*"
 
Our Access 2003 db has 2 asterisks placed after the last name and I would
like to remove them from the db. I am hoping that I would not have to do this
by hand as there are over 6,000 entries.

Please advise

A criterion of

LIKE "*[*]"

will find all records where the field ends in a literal asterisk. The LIKE
operator treats an asterisk as a wildcard (matching any string); putting the
asterisk in brackets tells the program to treat it literally instead.

To remove the two asterisks at the end of the field LastName you could use an
update query

UPDATE mytable SET [LastName] = Left([LastName], Len([LastName] - 2) WHERE
[LastName] LIKE "*[*][*]";

Back up your database first just to be safe!!
 
Back
Top