By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,406 Members | 2,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,406 IT Pros & Developers. It's quick & easy.

ADO Connection Open fails with error -2147467259 when MS Access database under Source Safe

P: n/a
gm
Immediately after generating the Access application from the Source
Safe project I get:

"-2147467259 Could not use ''; file already in use."

If Access database closed and then reopened I get:

"-2147467259 The database has been place in a state by user
'Admin' on machine ..... that prevents it from being opened or
locked."

This error will then persist - even past a machine reboot and compact
and repair of both application db (without source safe removal) and
'server' db. If I remove the Access application from Source Safe
the ADO connection opens fine. (Might have to close database and
reopen it to get it working the first time after eliminating source
safe.)

I do not appear to be short on memory. Am using:

Access 2003 with sp1
Source Safe 6.0d
Windows XP Professional with sp2
Database in Access 2002-2003 format
Microsoft ActiveX Data Objects 2.7 Library

I have isolated error in test database with just one table and one
form. Test1 fails under source safe while Test2 - which avoids use
of the offending open command -works regardless of use of source safe.

Any illumination on this would be appreciated. I have found the Source
Safe & Access combination hard going but I do not want to loose source
code control. This issue has undermined my confidence in these tools
yet again. Many thanks.
GM

Option Compare Database
Option Explicit

Private Sub cmdTest1_Click()
On Error GoTo Error_Handler

Dim cnn As ADODB.Connection
Dim rtbl As ADODB.Recordset
Dim lngTest As Long

Set cnn = New ADODB.Connection
Set rtbl = New ADODB.Recordset

lngTest = 1

' Have tried eliminating the with block - no difference. GM
With cnn
.ConnectionString = CurrentProject.Connection
.Open ' This Open command fails with -2147467259 error if
application under source safe. GM
End With

'Open 'insert cursor' on test table
rtbl.Open "Table1", cnn, adOpenStatic, adLockOptimistic, adCmdTable
With rtbl
.AddNew
!col1 = lngTest
.Update
End With

MsgBox "Test1 Inserted OK"

Exit_Sub:
On Error Resume Next
rtbl.Close
cnn.Close
Set cnn = Nothing
Set rtbl = Nothing
Exit Sub

Error_Handler:
MsgBox "An error has occured in this application. " _
& " Please contact your techincal support person and " _
& " tell them this information: " _
& vbCrLf & vbCrLf & "Error Number " & Err.Number & ", " _
& Err.Description, _
Buttons:=vbCritical
Resume Exit_Sub
Resume
End Sub
Private Sub cmdTest2_Click()
On Error GoTo Error_Handler

Dim rtbl As ADODB.Recordset
Dim lngTest As Long

Set rtbl = New ADODB.Recordset
lngTest = 2

'Open 'insert cursor' on test table
rtbl.Open "Table1", CurrentProject.Connection, adOpenStatic,
adLockOptimistic, adCmdTable
With rtbl
.AddNew
!col1 = lngTest
.Update
End With

MsgBox "Test2 Inserted OK"

Exit_Sub:
On Error Resume Next
rtbl.Close
Set rtbl = Nothing
Exit Sub

Error_Handler:
MsgBox "An error has occured in this application. " _
& " Please contact your techincal support person and " _
& " tell them this information: " _
& vbCrLf & vbCrLf & "Error Number " & Err.Number & ", " _
& Err.Description, _
Buttons:=vbCritical
Resume Exit_Sub
Resume

End Sub

Jan 25 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.