Shane LeBlanc
Shane LeBlanc

Reputation: 2643

Access SQL Transactions?

I've read that MS Access supports transactions but when I try to use it, I get the error Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. All I'm writing out is...

BEGIN TRANSACTION
    INSERT INTO MyTable1(Field1, Field2, etc...) VALUES (Value1, Value2, etc...)
    INSERT INTO MyTable2(Field1, Field2, etc...) VALUES (Value1, Value2, etc...)
COMMIT TRANSACTION

This is in a stored query in Access. Why is it giving me this error if it is supported?

http://msdn.microsoft.com/en-us/library/office/bb208950(v=office.12).aspx

Upvotes: 4

Views: 3213

Answers (1)

Johnny Bones
Johnny Bones

Reputation: 8404

Transactions are not supported in MSAccess when you are using them in a query. Try firing a function to create those queries, which you can do in a module and have it run on PageLoad or even an OnTimer event. You can use the BeginTrans and Rollback commands inside the module.

Upvotes: 4

Related Questions