Make your own free website on Tripod.com

CLOSING & EXITING


As noted in the Open Connection topic, I declare my connection variables in a .bas module and create a connection object in a sub procedure within that module. In the Main Form the connection is opened and can be used by all subsequent forms.

As I exit each subsequent form, I simply close my Recordset and Command object, leaving the connection remaining open:



Private Sub cmdExit_Click()

Unload Me

rs.Close

Set rs = Nothing

Set mdkcmd = Nothing

Set myobj = Nothing

End Sub



When these forms are exited/closed, the focus is returned to the Main Form. When the Main Form is exited/closed, the Connection is then terminated:

Private Sub cmdExit_Click()

Unload Me


conn.Close

Set conn = Nothing


Set mdkcmd = Nothing

Set myobj = Nothing

End Sub


RETURN TO HOME PAGE