Close Method

See AlsolanCloseMethodSee

Description

Closes a specified DatabaseWNISZP, QueryDef19G3DMW, or recordset22S7WAF.

Syntax

database.Close

recordset.Close

querydef.Close (Professional Edition Only)

Remarks

The Close method uses these parts:

Part                 Description

 

database          The Database property of a data control.  In the Professional Edition, can also be an object variableZ3R9Q5 identifying an open Database.

recordset          The Recordset property of a data control.  In the Professional Edition, can also be an object variable identifying an open Table, Dynaset, or Snapshot.

querydef           In the Professional Edition, an object variable that identifies an open QueryDef.

 

If you close the recordset or database of a data control, the data control sets all bound controlsLVLJ7W to Null and nothing will happen when a user clicks the buttons on the data control.

Using Close on the Recordset property of a data control automatically invokes the Update method if an Edit or AddNew operation is pending.  Using Close on the Database property of a data control automatically closes all open recordsets.  Unloading a form automatically closes a data control's Database property.

If the object is already closed when you use Close, an error occurs.

 

Caution   In the Professional Edition, if you are not using a data control you should use Close on all open recordsets before you close a database.  Otherwise you might lose changes from pending Edit or AddNew operations.

 

In the Professional Edition, any local object variables identifying Databases, Dynasets, QueryDefs, or Tables are automatically closed when the procedure exits.  If you are not using a data control, attempting to close a Database that has open recordsets will generate an error.