在这里,我使用了代码。 我是VBA的新手。 我试图将一个列表框移动到另一个列表框,但我无法更新数据库表。我几天都很挣扎。为什么会出现此错误,如何解决此问题。任何人都可以帮助我。
Dim varAdd As Variant
Dim strSQL As String
With lstFresh
For varAdd = lstFresh.ListCount - 1 To 0 Step -1
If lstFresh.Selected(varAdd) Then
strSQL = "UPDATE DatabaseMaintanence..UserMaster SET DatabaseMaintanence..UserMaster.usr_Team = '3' from DatabaseMaintanence..UserMaster inner join Infotronics..EmployeeGeneralMaster on (Status = 'W' and usr_Team = '1' and CampaignGroup like '%uk%survey%') and DatabaseMaintanence..UserMaster.usr_ReportName = " & varAdd & ""
Me.lstFresh.ItemData(varAdd) & "'"
lstteamtwo.AddItem .List(varAdd)
.RemoveItem varAdd
End If
Next varAdd
End With