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 - 16 May 2005 14:57 GMT
the one thing i failed to mention is that this is a Vb6 app thats uses
Access as the back end.
Daniel
Dan - 18 May 2005 17:01 GMT
i removed the system database from the equation now but the problem remains.
anyone ???
daniel
Dan - 23 May 2005 15:38 GMT
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