Reputation: 3
I'm having an issue with Access. I'm trying to update one table (shipmentdata) with a few values from another table (customers). This is my code right now:
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
I keep getting an error: "Run-time error '3075': Syntax error (missing operator) in query expression 'B.OfficeNbr FROM A INNER JOIN Customers As B ON A.Owner = B.Name'.
I've tried it with/without aliases, with/without brackets in different places, I keep getting this error. Can someone help me please?
Upvotes: 0
Views: 152
Reputation: 204924
UPDATE ShipmentData A
INNER JOIN Customers B ON A.Owner = B.Name
SET A.[Sales Rep] = B.[Sales Rep],
A.OfficeNbr = B.OfficeNbr
Upvotes: 1