How do I remove hyphens or periods in name using access 2000?

J

Jan B

When down loading employee's names to a table you have periods and hyphens in
names and I need to remove them.
Ex: John Brown-Smith to read John Brown Smith
Ex: Anthony Contreras, Jr. to read Anthony Contreras Jr
Have you come across a way to easily remove these characters from a text
field.
 
K

kingston via AccessMonster.com

Create a function that uses the Replace() function for every unwanted
character.
string1 = Replace(string,"-"," ")
string2 = Replace(string1,","," ")
...
 
D

Douglas J. Steele

Or do it in a single step:

string = Replace(Replace(string,"-"," "), ",", " ")
 
K

Klatuu

Use a calculated field name in your query. The example below will replace
all hypens and periods with spaces. It may be that you want to replace
periods with a zero lenth string. If so, use the second version

EmpName: Replace(Replace([EmployeeName],"."," "),"-"," ")
EmpName: Replace(Replace([EmployeeName],".",""),"-"," ")
 
Top