Access| Error | Resolution applies to:
Microsoft Active Server Pages
Microsoft Data Access Components 1.5
Microsoft Data Access Components 2.0
Microsoft Data Access Components 2.1
Microsoft Data Access Components 2.1 SP1
Microsoft Data Access Components 2.1 SP2
Microsoft Data Access Components 2.5
Microsoft Data Access Components 2.5 SP1
Microsoft Data Access Components 2.5 SP2
Microsoft Data Access Components 2.6
--------------------------------------------------------------------------------
This is article was previously published under Q306441
The occurrence of the problem
When we try to connect to an MS Access database with ActiveX Data Objects (ADO) and Open Database Connection (ODBC), you may return the following error message:
Microsoft OLE DB Provider for ODBC Drivers error ' 80004005 '
[Microsoft] [ODBC Microsoft Access Driver] Couldn ' t lock file.
The cause of the occurrence
This error message is generated because you do not have permission to create a lock file (. ldb) file on an MS Access database. The system defaults to the creation of lock file (. ldb) in the same directory as a Microsoft Access. mdb file.
Solving method
Follow the steps below:
1. Users who grant access to the database (usually iusr_<computername> account) have complete control over the shared folder.
2. Since lock file (. ldb) files are often set to read-only (read-only), sharing is often restricted. So, we can try to change the connection by using the following demo code:
Set Conn = Server.CreateObject ("ADODB. Connection ")
Conn.mode = adModeShareDenyWrite ' 8
' The definition in the Adovbs.inc
'----ConnectModeEnum Values----
' Const adModeUnknown = 0
' Const adModeRead = 1
' Const adModeWrite = 2
' Const adModeReadWrite = 3
' Const adModeShareDenyRead = 4
' Const adModeShareDenyWrite = 8
' Const admodeshareexclusive = &HC
' Const adModeShareDenyNone = &h10
Reference bibliography
To learn more, please click on the following connection:
174943 prb:80004005 "couldn ' t use ' (unknown)"; File already in use "
183060 info:troubleshooting Guide for 80004005 and other Error Messages