访问VBA |如何用另一个字符串替换字符串的一部分 [英] Access VBA | How to replace parts of a string with another string

查看:412
本文介绍了访问VBA |如何用另一个字符串替换字符串的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一段代码,用一个单词替换另一个单词. 示例:将Ave替换为Ave,将North替换为N. 我正在使用MS Access,可以使用SQL REPLACE函数,但是我想在VBA中使用Access模块​​来执行此操作,以便可以将该函数附加到其他列.

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.

推荐答案

使用Access的VBA功能

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

Dim result As String

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

这篇关于访问VBA |如何用另一个字符串替换字符串的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆