Name

Recordset.Close Method — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

                     recordset.Close

The Close method closes a Recordset object.

Description

The Close method closes either a Connection or a Recordset object. When you invoke this method on either object, all dependant objects of your connection or recordset are also closed. You would use the Close method to free system resources although the resource still remains in memory. After closing a Connection or Recordset object, you can still open it again. To completely remove the object from memory, set it to Nothing.

When calling the Close method of the Connection object, all associated Recordset objects will be closed, but the associated Command object will persist, thus setting the ActiveConnection property to Nothing and clearning the Parameters collection of the Command object. You can still use the Open method to connect to a data source.

If you close a Connection object that has any associated open Recordset objects, any pending changes of the Recordset objects will be rolled back. By calling the Close method of the Connection object while a transaction is in progress, you generate an error. If a Connection object falls out of scope while a transaction is in progress, the transaction is automatically rolled back.

When you use the Close method on the Recordset object, that object releases any exclusive access you may have to the data and releases any associated data. You can still use the Open method of that Recordset object later, after ...

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.