Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find and Replace Asterisk Character

Status
Not open for further replies.

startup

Technical User
May 22, 2002
42
US
This is a curious problem. I have a bunch of records in a table that have an asterisk (*) character at the beginning of them. I want to use the Access 2000 Find and Replace function to delete these characters. However, when I enter the asterisk symbol in the Find field it finds every single record in the field and replaces the entire value with my null value!! How can I get rid of these asterisks?

Thanks
Rico
 
the "*" is chr(42). You need to write a custom search and replace for this (and other 'special' characters). A simplistic version might be similar to:

Code:
MyStr = "*1234*&^%*&"
? Replace(MyStr, "*", "")
1234&^%&

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
I found the answer, if I'd only looked far enough. This is from the Access help file:

When using wildcard characters to search for an asterisk (*), question mark (?), number sign (#), opening bracket ([), or hyphen (-), you must enclose the item you're searching for in brackets. For example, to search for a question mark, type [?] in the Find dialog box. If you're searching for a hyphen and other characters simultaneously, place the hyphen before or after all the other characters inside the brackets. (However, if you have an exclamation point (!) after the opening bracket, place the hyphen after the exclamation point.) If you're searching for an exclamation point (!) or closing bracket (]), you don't need to enclose it in brackets.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top