The cause of the error is often mismatch of BEGIN and COMMIT as clearly stated by the error. This means using:
Begin Transaction
Begin
-- your query here
End
commit
instead of
Begin
Begin
-- your query here
End
commit
omitting Transaction after Begin causes this error!