Support
for
Windows Accounts

A division of WAASI For Standard Plans or Dedicated Servers please click here.

Windows Support Home > Access Database Lock problem

 

Access Database Issues

My Access database seems to be locked. When I try to upload a new data base I can't. Sometimes even when a second person goes to it with a browser they get an error. What's wrong?

We never set the databases for exclusive access so the place to look is in your code.

This problem is generally caused by your ASP code that calls the database.  The database is being opened while the data is read but it is not being closed again. This will lock the database preventing further access to it.

Below are some code snips from code generated by Access that will cause the problem.

Start of code:

Param = Request.QueryString("Param")

Data = Request.QueryString("Data")

%>

<%

If IsObject(Session("_conn")) Then

Set conn = Session("_conn")

Else

Set conn = Server.CreateObject("ADODB.Connection")

conn.open "driver={Microsoft Access Driver

 End of code:

<%

rs.MoveNext

loop%>

</TBODY>

<TFOOT></TFOOT>

</TABLE>

</BODY>

</HTML>

The above code opened the database read the file contents and displayed them. This was code generated by Access.  Note that the database was never closed. In order to fix this database lock problem the end code was changed to:

<%

> rs.MoveNext

> loop

> rs.Close

> conn.Close

> Set rs = Nothing

> Set conn = Nothing

> %>

> </TBODY>

> <TFOOT></TFOOT>

> </TABLE>

> </BODY>

> </HTML>

No matter  what your code is just keep in mind that if you open the database you will have to close it after you read the data or you will have the locked database problem.