Find and Replace within a macro

innocent_smoothie

New member
Local time
Today, 13:15
Joined
May 23, 2009
Messages
6
In my macro, I want to open a table ("Products") search through a field ("ProductCode"), find a text character ("%") and replace it with a blank

Can this be done ?
 
I would use an update query with the Replace() function. You could run the query from a Macro.
 
Thanks for the reply

I am familiar with update queries, but can't work out how to build a replace() functon into one. Do I need to use sql code?
 
Using the Query Designer, In the Update to for your field try:

Replace([YourFieldName], "%" , "" )
 
wow! result!

:):):):):):):):):):)

Thank you so much.

By the way, I notice this works with Access 2003, but in Access 2000 you get the message "Undefined function 'Replace' in expression" so I guess it was a new feature in 2003
 
You're welcome!

Actually the Replace() function was first introduction into Access VBA with the 20000 version. It is not available in '97 and earlier versions.

Check the 2000 help file.
 
I am a newbie, and I was wondering if this method could be used to insert text before a fields contents. What I want to do is have 2 letters, "BR ", placed in front of all cells which contain a dash "-". Is this possible? Thanks
 

Users who are viewing this thread

Back
Top Bottom