56

The Access Object Model

VBA provides the ability to work with the Access 2010 program directly, through the use of the Access Object Model. The Access Object Model is a collection of classes that are designed specifically to allow the developer to use Access features using directly in VBA code. For example, say you want to open a database in the Access program using VBA code; the developer could call the OpenCurrentDatabase method to accomplish this task. The Access Object Model provides the ability to create instances of the Access program, open and close database files, interact with database objects, and even run the Access wizards and other features of Access 2010. This lesson discusses the Access Object Model and shows how it can be used in VBA code.

LESSON SETUP

This lesson is designed to provide some basic information about using the Access Object Model. You should be familiar with Access databases, creating modules, and the basics of VBA programming. Otherwise, this lesson does not require any other specific knowledge of Access.

THE ACCESS APPLICATION OBJECT

The Access.Application object is the basis for working with all functionality within the Access program. By default, every database created in Access has a reference set to the Access Object Model in the VBA code project. For example, databases created by Access 2010 automatically have a reference set to the Microsoft Access 14.0 Object Library. This reference is what provides the ability to use Access objects, such ...

Get Microsoft® Access® 2010 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.