hakubaa
hakubaa

Reputation: 169

SQL/Excel/VBA - UPDATE query: 'Syntax Error (missing operator) in query expression'

I have very simple query that is not working and I get error:

'Syntax Error (missing operator) in query expression Tabela2.SALES2 FROM Tabela2'

Here is the code:

UPDATE Tabela1 
SET Tabela1.SALES = Tabela2.SALES2 
FROM Tabela2 
WHERE Tabela1.ID = Tabela2.ID

I want to run this query from VBA/Excel on Acces database (2007). Others queries with e.g. SELECT are working fine, so the problem is only with the query. And I really don't know why it is not working.

Upvotes: 1

Views: 4086

Answers (4)

Rupam
Rupam

Reputation: 1

Update TABLE2, TABLE1
SET TABLE2.SALES2 = TABLE1.SALES
WHERE TABLE2.ID=TABLE1.ID

hey friends try this 100% working. As per poonam FROM statement is not possible and its true but no need to inner join and make your query slow down.
This SQL Query will run on MS Access only.

Upvotes: -1

Poonam
Poonam

Reputation: 679

An UPDATE query using FROM is possible in SQL Server, but not in MS Access. Use this instead:

UPDATE Tabela1 INNER JOIN Tabela2 ON Tabela1.ID = Tabela2.ID 
SET Tabela1.Sales = [Tabela2].[Sales2];

Upvotes: 4

Luis LL
Luis LL

Reputation: 2993

try this

UPDATE Tabela1 
SET Tabela1.SALES = Tabela2.SALES2 
FROM Tabela1 
INNER JOIN Tabela2 
WHERE Tabela1.ID = Tabela2.ID

Upvotes: 0

user1957877
user1957877

Reputation:

UPDATE Tabela1 SET Tabela1.SALES = Tabela2.SALES2 FROM Tabela1,Tabela2 WHERE Tabela1.ID = Tabela2.ID

Upvotes: 0

Related Questions