When you use ActiveX Data Object (ADO) to connect to Microsoft SQL Server from a Microsoft Visual Basic for Applications (VBA) form, the best practice is as follows:
Consider the following scenario:
- Open the connection when the window is open.
- Close the connection when the window is closed.
Consider the following scenario:
- You click the Close box.
- You receive the following message:
- You click Cancel.
Note You will receive an error the next time that you try to use the connection that is now closed.