在查询VBA中传递不带引号的字符串变量 [英] pass string variable without quotes in query vba

查看:184
本文介绍了在查询VBA中传递不带引号的字符串变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim StoreNoToUpdate As String
Dim Marsha As String

StoreNoToUpdate = "ABCXYZ123"

Marsha = "hi"

db.Execute "Update TblLodgingReport set [MarshaCode]=  'Marsha'  where [Store Number ID]= 'ABCXYZ123'"

我正在尝试在"ABCXYZ123"位置更新"hi".但不粘贴"hi",而是粘贴"Marsha".

I am trying to update "hi" at "ABCXYZ123" location. but its not pasting "hi", instead its pasting "Marsha".

推荐答案

尝试:

Dim StoreNoToUpdate As String
Dim Marsha As String

StoreNoToUpdate = "ABCXYZ123"

Marsha = "hi"

Db.Execute "Update TblLodgingReport set [MarshaCode]='" & Marsha & "'where [Store Number ID]= 'ABCXYZ123'"

这篇关于在查询VBA中传递不带引号的字符串变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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