Avatar of munkyxtc
munkyxtc

asked on 

VBA Fucntion to replace all instances of characters via Regular Expression.

I'm looking to write a function to call via a query which will clean up some unwanted characters in some data I was given.  I can successfully strip out the first occurrence of the first character in my re; however, I need to iterate through the string until no occurrences of the shown characters appear in the string.  

I usually don't work with Access or VBA so I'm sure the question is pretty easy for one of you pros out there.

I've attached the code that is semi-working.  

Thanks.
Function Cleanup(arg As String) As String
Dim re As Object
Set re = CreateObject("VBScript.RegExp")
re.Pattern = "[.;,]"
Cleanup = re.Replace(arg, "")
End Function

Open in new window

Microsoft Access

Avatar of undefined
Last Comment
munkyxtc
ASKER CERTIFIED SOLUTION
Avatar of munkyxtc
munkyxtc

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo