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

ms-accessvba

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

Best Answer

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

Dim result As String

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