MS Access 2007 Replace Macro

How i replace a specific value into a hole table using a Macro.    For Example if you have a field called Name and you need change every quoutes by a dash -.
JAYAYOAsked:
Who is Participating?
 
BobTheViolentCommented:
I suggest using an SQL query.

In the macro you would do a "DoCmd.RunSQL" and then this.

UPDATE TABLENAME SET TABLENAME.FIELD= Replace([FIELD],Chr(34),"-");

this example replaces all occurences of a double quote with a dash as you asked.


Look up a chr code on this website to know which chr(#) to use
http://www.asciitable.com/
0
 
Patrick MatthewsCommented:
UPDATE SomeTable
SET SomeColumn = Replace(SomeColumn, """", "-")
0
 
JAYAYOAuthor Commented:
Fastest response Excellent you save many work hours.
Thanks
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
JAYAYOAuthor Commented:
Class A.  Thanks
0
 
Patrick MatthewsCommented:
JAYAYO,

Please explain your disposition to this question.  The syntax I provided was syntactically identical to the SQL
BobTheViolent posted, and I posted a little bit ahead of him.

A split would have suited me just fine, but I feel it is patently unfair to have received no credit on this one.

Patrick
0
 
Patrick MatthewsCommented:
BobTheViolent,

Please do not take my message above as a criticism.  I do not think you did anything wrong here :)

Regards,

Patrick
0
 
BobTheViolentCommented:
matthewspatrick,
  I agree with you.  A split 50/50 would be fair since you did post before me with the same basic answer and we were both correct.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.