Sub Rst_Disconnected()
Dim conn As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Dim strConn As String
Dim strSQL As String
Dim strRst As String
strSQL = "Select * From Orders where CustomerID = 'VINET'"
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConn = strConn & "Data Source = " & CurrentProject.Path & "\mydb.mdb"
Set conn = New ADODB.Connection
conn.ConnectionString = strConn
conn.Open
Set myRecordset = New ADODB.Recordset
Set myRecordset.ActiveConnection = conn
' retrieve the data
myRecordset.CursorLocation = adUseClient
myRecordset.LockType = adLockBatchOptimistic
myRecordset.CursorType = adOpenStatic
myRecordset.Open strSQL, , , , adCmdText
Set myRecordset.ActiveConnection = Nothing
myRecordset.MoveFirst
Debug.Print myRecordset.Fields(0) & " was " & myRecordset.Fields(1) & " before."
myRecordset.Fields("CustomerID").Value = "OCEAN"
myRecordset.Update
strRst = myRecordset.GetString(adClipString, , ",")
Debug.Print strRst
End Sub
|