[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Replace character

Posted on 2012-12-28
5
Medium Priority
?
216 Views
Last Modified: 2013-01-21
I am trying to clean up some imported data that has numerous special characters eg "-","/","\"," ").i would like to replace the  special characters with ","(chr(44)).I need the most efficient way of doing this.Thanks
0
Comment
Question by:Svgmassive
[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
5 Comments
 
LVL 48

Expert Comment

by:Dale Fye
ID: 38726982
Where is your data coming from?  

What application do you want to do the "cleanup" from (Access or Excel)?

Is this for a single field in the data, or multiple fields?

Could some of these characters ("\") be delimiters for file names or in hyperlinks that should not be removed?
0
 

Author Comment

by:Svgmassive
ID: 38727079
the application is ms access,they are not delimiters and the characters can be removed.Thanks
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 38727141
one or more fields?

You can create a simple Update query, something like:

UPDATE yourTable
SET yourField = Replace([yourField], "/", chr$(44))

If you need to do this for multiple fields, and multiple characters, you could create an array of the characters and a second array of field names, then create two loops (one for fields, the other for characters) and run this query inside the inner loop.

This will not work if your table is a Linked Excel worksheet, it will only work if the data has been imported into Access.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 38727553
MyData = Replace(MyData, "/",chr(44))

Do the above for each special character.
0
 
LVL 40

Accepted Solution

by:
als315 earned 2000 total points
ID: 38727792
If this operation should be done only once, you can open table and use standard find & replace (Find button on ribbon or Ctrl+F). If it should be done many time, use update query with this function:
Function rpl(A As String) As String
Dim Arr As Variant, i As Integer
rpl = A
Arr = Array("-", "/", "\", " ")
For i = 0 To UBound(Arr)
    rpl = Replace(rpl, Arr(i), Chr(44))
Next i
End Function

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

649 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