I use the following subs in VB6 to open a connection and a recordset in an Access97 database. The problem is in the Open_Recordset sub when I end the sum the recordset closes. It opens fine correctly but I need it to stay open after ending the sub so I can work with it. Is this possible, thanks.
If Conn.State <> adStateOpen Then
With Conn
.CursorLocation = adUseServer
.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;" & _
"Data Source=C:\Collections\Collections.accdb; Persist Security Info = False;"
.Open
End With
End If
End Sub
Public Sub Open_RecordSet(SQL As String)
If Conn.State <> adStateOpen Then
Open_Connection
If rs.State = adStateOpen Then rs.Close
rs.Open SQL, Conn, adOpenStatic, adLockOptimistic
Else
If rs.State = adStateOpen Then rs.Close
rs.Open SQL, Conn, adOpenKeyset, adLockOptimistic
End If
End Sub
If Conn.State <> adStateOpen Then
With Conn
.CursorLocation = adUseServer
.ConnectionString = "Provider=Microsoft.Ace.OLEDB.12.0;" & _
"Data Source=C:\Collections\Collections.accdb; Persist Security Info = False;"
.Open
End With
End If
End Sub
Public Sub Open_RecordSet(SQL As String)
If Conn.State <> adStateOpen Then
Open_Connection
If rs.State = adStateOpen Then rs.Close
rs.Open SQL, Conn, adOpenStatic, adLockOptimistic
Else
If rs.State = adStateOpen Then rs.Close
rs.Open SQL, Conn, adOpenKeyset, adLockOptimistic
End If
End Sub