Access VBA | How to replace parts of a string with another string

calendar_today Asked Dec 18, 2011
thumb_up 44 upvotes
history Updated April 16, 2026

Question posted 2011 · +25 upvotes

I am trying to create a piece of code that replaces one word with another. Example: Replace Avenue with Ave and North with N. I am using MS Access, I could use SQL REPLACE Function but I want to do this in VBA using Access module so that I can attached the function to other column.

I am not sure where to start with this, so any input will be greatly appreciated.

Guy

Accepted answer +44 upvotes

Use Access’s VBA function Replace(text, find, replacement):

Dim result As String

result = Replace("Some sentence containing Avenue in it.", "Avenue", "Ave")

Top vba Q&A (6)

+44 upvotes ranks this answer #6 out of 81 vba solutions on this site — top 7%.
vba