0

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?

2
  • Without doing research and taking a shot in the dark: I think you forgot to include your "SELECT" in your inner select statement. Commented Jul 29, 2013 at 17:29
  • The right sintax of UPDATE doesn't include any FROM: UPDATE aTable AS a INNER JOIN anotherTable AS b SET ... Commented Jul 29, 2013 at 17:38

1 Answer 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
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much! Worked like a charm. My syntax are bad.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.