O
omsoft
I have the following function in Excel app which uses Access as back-end.
Here it reads a table in back-end and retrieves an boolean to determine which
code path to follow. Every once in a while, I get an error that the <machine
name> has put the data base in admin state. The line it points to
conn.open(strConn) line in the function.
Does anyone have any thoughts on what this could be?
Thanks.
Public Function getCodePath()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strConn, strDB, strSQL As String
strSQL = "SELECT * FROM tmp_fromOscar"
strDB = OSCAR_DIR & OSCAR_DATA
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & strDB & ";"
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open (strConn)
conn.CursorLocation = adUseClient
rs.Open strSQL, conn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
rs.MoveFirst
bFrom = rs("fromO").Value
End If
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
getCodePath = bFrom
End Function
Here it reads a table in back-end and retrieves an boolean to determine which
code path to follow. Every once in a while, I get an error that the <machine
name> has put the data base in admin state. The line it points to
conn.open(strConn) line in the function.
Does anyone have any thoughts on what this could be?
Thanks.
Public Function getCodePath()
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strConn, strDB, strSQL As String
strSQL = "SELECT * FROM tmp_fromOscar"
strDB = OSCAR_DIR & OSCAR_DATA
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & strDB & ";"
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open (strConn)
conn.CursorLocation = adUseClient
rs.Open strSQL, conn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
rs.MoveFirst
bFrom = rs("fromO").Value
End If
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
getCodePath = bFrom
End Function