ne of the great and flexible features of the amazing elastic ADO recordset is that it can be disconnected from its data source, modified, and reconnected to update the data source. Once disconnected, it can be saved to disk or inserted into an email, and sent to another user. The second user can make changes and send it back to the first user, who can then open it from disk and update the data source. Here are the step-by-step instructions:
1. Open a client side recordset in UpdateBatch mode:
Dim rs as New ADODB.Recordsetrs.CursorLocation=adUseClientrs.LockType= adLockBatchOptimisticrs.Open Source:="Select * From Authors", ActiveConnection:="Pubs" 'Pubs is an ODBC DSN
2. Disconnect the recordset by setting its ActiveConnection to Nothing. Don’t close the connection. When a connection is closed it closes all associated recordsets.
Set rs.ActiveConnection = Nothing
3. Modify the data. Even though the recordset is disconnected from its data source, it is still fully functional. You can make changes to the data and save it using the Update method. All changes are stored in the recordset until the UpdateBatch method is called. The quickest way to display and modify the data is to place an instance of the Microsoft DataGrid 6.0 OLEDB (MSDATGRD.OCX) on a form and set its DataSource property to the recordset.
4. Save the recordset to disk. Use the recordset’s Save method. You can save it with any extension, I prefer .rs:
5. Send the recordset file to another user via floppy disk or email. She can open it using the recordset’s Open method with adCmdFile for the Options argument:
rs.Open Source:="D: Authors.rs", Options:=adCmdFile
6. The second user can modify the data and save changes back to the persisted file from which the recordset was opened by calling the recordset’s Save method without specifying a filename.
7. The second user can send it back to the first user who can reconnect the recordset by setting it to a valid connection. If the recordset is already open then close it using the Close Method.
On Error Resume Nextrs.CloseOn Error Goto 0rs.ActiveConnection = "Pubs"
8. To update the data source with all the changes call the recordset’s Updatebatch method.