我遇到了Access问题。我试图用另一个表(客户)中的一些值更新一个表(shipmentdata)。这是我现在的代码:
Option Compare Database
Sub Update()
Dim strSQL As String
strSQL = "UPDATE ShipmentData As A " & _
"SET A.[Sales Rep] = B.[Sales Rep], A.OfficeNbr = B.OfficeNbr " & _
"FROM A " & _
"INNER JOIN Customers As B " & _
"ON A.Owner = B.Name;"
DoCmd.RunSQL strSQL
End Sub
我一直收到错误:"运行时错误' 3075':查询表达式中的语法错误(缺少运算符)&B; B.OfficeNbr FROM INNER JOIN Customers as B ON A.Owner = B.Name'。
我已尝试使用/不使用别名,在不同位置使用/不使用括号,我不断收到此错误。有人能帮帮我吗?
答案 0 :(得分:1)
UPDATE ShipmentData A
INNER JOIN Customers B ON A.Owner = B.Name
SET A.[Sales Rep] = B.[Sales Rep],
A.OfficeNbr = B.OfficeNbr