0

我在使用 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.OfficeNbr FROM A INNER JOIN Customers As B ON A.Owner = B.Name'中的语法错误(缺少运算符)。

我试过带/不带别名,在不同的地方带/不带括号,我一直收到这个错误。有人能帮助我吗?

4

1 回答 1

1
UPDATE ShipmentData A
INNER JOIN Customers B ON A.Owner = B.Name
SET A.[Sales Rep] = B.[Sales Rep], 
    A.OfficeNbr = B.OfficeNbr
于 2013-07-29T17:28:41.010 回答