Solved

MS Access 2007 Replace Macro

Posted on 2008-10-30
7
236 Views
Last Modified: 2013-11-27
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 -.
0
Comment
Question by:JAYAYO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 22844382
UPDATE SomeTable
SET SomeColumn = Replace(SomeColumn, """", "-")
0
 
LVL 2

Accepted Solution

by:
BobTheViolent earned 250 total points
ID: 22844417
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
 

Author Comment

by:JAYAYO
ID: 22847252
Fastest response Excellent you save many work hours.
Thanks
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Closing Comment

by:JAYAYO
ID: 31511815
Class A.  Thanks
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 22849101
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
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 22849102
BobTheViolent,

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

Regards,

Patrick
0
 
LVL 2

Expert Comment

by:BobTheViolent
ID: 22851327
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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question