小编典典

在查询VBA中传递不带引号的字符串变量

sql

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”。


阅读 199

收藏
2021-04-14

共1个答案

小编典典

尝试:

Dim StoreNoToUpdate As String
Dim Marsha As String

StoreNoToUpdate = "ABCXYZ123"

Marsha = "hi"

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