METHOD:  Recordset::Save

recordsetobject.save Destination, PersistFormat

The Save method is called to save a Recordset object to a file or a Stream object.

You can only call this method on an open Recordset. After the save is complete, the Recordset will still be open and the current record pointer will be on the first record.

If any asynchronous operation is occurring, such as a fetch or update, this method will wait until the operation is completed before performing the save.

If a filter is in place, only the visible records are saved.

There are two optional parameters.

The optional Destination parameter is a variant that is either a string that contains the complete path to the file where you want the Recordset object to be saved, or is a reference to a Stream object.

You have the option of declaring this parameter the first time you save a specific Recordset. When you subsequently resave the same Recordset, this method will automatically save that Recordset to the same location without you having to re-declare this parameter. In fact, if you do re-declare the same value for this parameter, you will get an error. If you do not specify a Destination, the new file will be set to the path/name value of the Source property of the Recordset object being saved.

Of course, you can save the Recordset to a new location by using this parameter any time after the first save. Note that you will end up with two open Recordset objects, each at a different location.

The optional PersistFormat parameter is one of the PersistFormatEnum constants that specify the format, either ADTG or XML, in which to save the Recordset.

PersistFormatEnum Constants
 
Constant Value Description
adPersistADTG 0 Save in the Microsoft Advanced Data TableGram (ADTG) format
adPersistXML 1 Save in the Extensible Markup Language (XML) format

 
In this example, the Recordset is saved to a new file location and the original Recordset is closed. The Recordset is later reopened using the new file location.

Code (VBScript):
objRecordset.Save "C:\GuruData\Meditation.dat"
objRecordset.Close
Set objRecordset = Nothing
...
objRecordset.Open "C:\GuruData\Meditation.dat"

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information