Navigation:  Articles > May-1998 >

Tip: dbFailOnError Rollback

Previous pageReturn to chapter overviewNext page

Steve Sarre          
 
In previous releases of Data Access Objects (DAO), if you executed SQL statements, they were internally treated as transactions. If you executed a statement with the dbFailOnError flag on and the query failed, the operation was rolled back. For performance reasons, a SQL statement is no longer treated as a transaction. Therefore, if a SQL query fails in Microsoft Access, an incomplete operation might occur. If you think an error might occur, you should explicitly use the statement within a transaction by using the BeginTrans method and the CommitTrans method. Note that explicit transactions might slow query performance.
 
However, when I tested this for myself on regular Access queries, the operation was rolled back. Either way, for the moment it looks like I'll be extra careful and probably use explicit transactions.