I just executed some new vba code, that somehow caused my database to freeze up. the full text of the message is:
Runtime error 80004005...
The database has been placed in a state by user ‘Admin’ on machine “Pondside” that prevents it from being opened or locked.
The relevant parts of the code are as follows:
Dim SQLString1 As String
Dim SQLString2 As String
Dim strSQL As String
Dim cnnct As ADODB.Connection
Dim rst1 As ADODB.Recordset
Dim rst2 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
Set rst2 = New ADODB.Recordset
cnnct.ConnectionString = CurrentProject.Connection
cnnct.Open
SQLString1 = "SELECT * FROM tblAddressNew "
SQLString2 = "SELECT * FROM tblExamScores"
strSQL = "[lngDID] = " & ThisDID
rst1.ActiveConnection = CurrentProject.Connection
rst1.CursorType = adOpenStatic
rst1.Open SQLString1
rst1.Find strSQL
If not rst1.EOF Then
StartDate = Nz(rst1!START)
CompleteDate = Nz(rst1!COMPLETE)
End If
[etc.]....
rst1.Close
Set rst1 = Nothing
rst2.Close
Set rst2 = Nothing
cnnct.Close
Set cnnct = Nothing
What happened is that the first time through I had a misspelling in the IF clause, using "rst" instead of "rst1". Once I made the correction, I think I did a run reset without executing the closes. Now as soon as I hit the cnnct.Open statement I get the error. Apparently there's something I can do to correct the situation, but I am unclear what that something is.
A fast reply would be very helpful, as I am due to meet with the clients this in a couple of hours.
Runtime error 80004005...
The database has been placed in a state by user ‘Admin’ on machine “Pondside” that prevents it from being opened or locked.
The relevant parts of the code are as follows:
Dim SQLString1 As String
Dim SQLString2 As String
Dim strSQL As String
Dim cnnct As ADODB.Connection
Dim rst1 As ADODB.Recordset
Dim rst2 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
Set rst2 = New ADODB.Recordset
cnnct.ConnectionString = CurrentProject.Connection
cnnct.Open
SQLString1 = "SELECT * FROM tblAddressNew "
SQLString2 = "SELECT * FROM tblExamScores"
strSQL = "[lngDID] = " & ThisDID
rst1.ActiveConnection = CurrentProject.Connection
rst1.CursorType = adOpenStatic
rst1.Open SQLString1
rst1.Find strSQL
If not rst1.EOF Then
StartDate = Nz(rst1!START)
CompleteDate = Nz(rst1!COMPLETE)
End If
[etc.]....
rst1.Close
Set rst1 = Nothing
rst2.Close
Set rst2 = Nothing
cnnct.Close
Set cnnct = Nothing
What happened is that the first time through I had a misspelling in the IF clause, using "rst" instead of "rst1". Once I made the correction, I think I did a run reset without executing the closes. Now as soon as I hit the cnnct.Open statement I get the error. Apparently there's something I can do to correct the situation, but I am unclear what that something is.
A fast reply would be very helpful, as I am due to meet with the clients this in a couple of hours.