Fix an Access 2010 INSERT Lock on a SQL Server Table
Question details
Identify why an Access 2010 INSERT is followed by a SQL Server SELECT timeout.

- Product
- Microsoft Access 2010 and SQL Server 2005
- Device & OS
- not provided
- Scenario
- An Access front end inserts a record into a linked SQL Server table and then runs a SELECT against it.
- Observed behavior
- The later SELECT times out because the table appears to remain locked. The process commits correctly in Access 2000, and only one user is connected.
Identify the INSERT and SELECT statements, the linked SQL Server table, and any forms or VBA code involved. Make sure you can inspect active sessions in SQL Server Management Studio with an account that has the necessary permissions.
Identify the blocking session and isolate the Access objects
Use this approach to find what holds the lock before changing the application.
Reproduce the timeout, then run EXEC sp_who2 in a SQL Server Management Studio query window. Check the blocked session and the session identified in the BlkBy column.
In a new query window, query sys.dm_exec_requests for the blocked session and inspect blocking_session_id, wait_type, and wait_resource. Use these details to identify the blocking request and resource.
In Access, create a minimal VBA procedure that runs only the INSERT and subsequent SELECT. Compare its behavior with the full process.
If the minimal procedure succeeds, close or disable open forms and subforms one at a time, then repeat the full process. Inspect their record sources and controls, including combo boxes, for activity involving the affected table.
Review the VBA transaction and test a pass-through INSERT
Use this approach if transaction handling or the way Access sends the INSERT appears to be involved.
Use WPS Office for documents and spreadsheets
WPS Office is a free, lightweight alternative for everyday document and spreadsheet work, with a familiar interface and support for common Microsoft Office formats to make migration easier. It does not repair Access-to-SQL Server connections or replace an Access database application.

Frequently Asked Questions
How can I find which session is blocking the SELECT?
Run EXEC sp_who2 in SQL Server Management Studio and check the BlkBy column. Then inspect blocking_session_id, wait_type, and wait_resource in sys.dm_exec_requests while the SELECT is waiting.
Why can blocking occur when only one user is connected?
One Access user can have multiple SQL Server sessions. A form, subform, query, or transaction on one connection can block a request on another.
Should I use a VBA transaction for a single INSERT?
Not necessarily. Test the INSERT without an explicit VBA transaction if it does not need to be atomic with other statements. If a transaction is required, use the correct DAO Workspace and explicitly commit or roll it back.
Can an Access form cause the SQL Server lock?
A form or subform can participate in the activity that causes blocking. Close or disable forms one at a time and retest, then inspect the record sources and controls of any form associated with the problem.
Does a pass-through query always fix the lock?
No. A pass-through query sends SQL directly to SQL Server, but other sessions or open transactions can still cause blocking. Create one through Query Design and select Pass-Through to compare its behavior.




