Home > Archive > MS Access Multiuser > May 2005 > Could not lock file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Could not lock file
Dan via AccessMonster.com

2005-05-16, 7:24 am

Hi

I have seen a lot on this error and all seem to point to permissions but in
this case i do not think permissions are the cause.

What i am doing is some tests to track an error that we are experiencing on
some sites.

So what i have done is create an application that opens and closes a
connection to database 50 times. Now if i run 1 instance of the application
then it works no problem, if i run 2 instances then there is a good chance
both of them will succeed, however run a third instance of the application
and there will be failures with the error

"-2147467259, Could not lock file"

Info
Access 2000, Ado 2.7

Code to open and close

On Error GoTo errStuffed

lblStart.Caption = "Start: " & Now

Dim lngCount As Long, sConnString As String, Conn As ADODB.Connection

lngCount = 1

Do Until lngCount = txtTime1.Text + 1

Set Conn = New ADODB.Connection
With Conn
.ConnectionString = "Data Source=" &
gclsSystem.DBFileNames.gsDBs1sdf & ";"
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Properties("Password").Value = "*****"
.Properties("User ID").Value = "******"
.Properties("Jet OLEDB:System database").Value =
gclsSystem.DBFileNames.gsDBSystem
.Mode = adModeShareDenyNone
.Open
End With

lblStatus1.Caption = "Open " & lngCount

Conn.Close
Set Conn = Nothing

lblStatus1.Caption = "Closed " & lngCount
DoEvents

lngCount = lngCount + 1

Loop

lblEnd.Caption = "End: " & Now

MsgBox "DONE"


Any help would be greatly appreciated...

daniel
Dan via AccessMonster.com

2005-05-16, 9:24 am

the one thing i failed to mention is that this is a Vb6 app thats uses
Access as the back end.

Daniel

--
Message posted via http://www.webservertalk.com
Dan via AccessMonster.com

2005-05-18, 11:24 am

i removed the system database from the equation now but the problem remains.

anyone ???

daniel

--
Message posted via http://www.webservertalk.com
Dan via AccessMonster.com

2005-05-23, 9:24 am

I have given up with this, i think the error is purely because Access is
weak in a multi user environment. Unfortunately i have to live with Access
so what i have done is this

Trap the error -21....
Loop until it can open the connection or my count = n
then either raise the error or it will have opened the connection and all
is good.

I know it is a weak solution but at the moment it is the only one i have
found.

Daniel

--
Message posted via http://www.webservertalk.com
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com