After a connection has been closed, it can be reopened and any changes the user made offline can be saved to the data source. The original connection information, such as the data source provider, is retained as long as the Connection object was disconnected using the Close method. If the Connection object is set to Nothing, all connection information must be re-established.

The following example code reconnects to a data source and associates the Recordset object with the connection:

Sub cmdReconnect_Click()
    cnStateUBookstore.Open
    rsStudents.ActiveConnection = cnStateUBookstore
End Sub