Closing the Connection

Once you've finished using the connection to a database file, you should always close the database connection, as shown in the following example:

oAccess.Close

You can go even further and create new databases, and then build the tables and queries within them using ADO and ADOX features. You can find a full reference of the ADO and ADOX objects, properties, methods, and events on the Microsoft MSDN Web site (http:// msdn.microsoft.com) or Microsoft's Microsoft Data Access and Storage Developer Center Web site (http://www.microsoft.com/data).

Tip One of the most often overlooked time-savers for working with external applications is the Macro Recorder feature. You can save an enormous amount of time and frustration in trying to figure out the specifics of performing a task in Excel by just doing the task while recording it, and then opening the results. Quite often, you can copy and paste the results directly into the AutoCAD VBA editor with minor modifications, and be on your way. This is true with any VBA-enabled product that has the Macro Recorder feature, including Microsoft Visio, PowerPoint, and Outlook.

0 0

Post a comment