UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> Access Object Model    
Image:NotifWarningWeak.gif This page has been marked as incomplete

Notes:
A stub - need to expand on various aspects of the article

If this page has been completed please remove the {{INCOMPLETE}} template from the page's source markup.
Image:NotifInfo.gif This page has been marked as requiring review

Notes:
Need to validate the information given are correct

If this page has been reviewed please remove the {{REVIEW}} template from the page's source markup.

Access Object Model enables people to manipulate Access via VBA code and automation. While one can learn VBA fairly fast, understanding Access object model is essential to mastering Access programming. Note furthermore that there are typically additional object models distinct from Access, such as DAO and ADO, as well Excel and Word. In case of Access and DAO, the relationship are so intertwined that it can be easy to mistake for a single object model but understanding the delineation will help with setting expectation toward how so and so object should behave.

Contents

Access Object Model Overview

For a full treemap of Access object model, refer to this MSDN page. The article focus on high-level understanding of the object model. Application object is considered the top level object from all other objects & methods derive. Whenever you're working in Access, it's rare to need to reference Application explicitly as it is implicitly. For example Application.CurrentDb() and CurrentDb() are fundamentally same thing. When you're automating Access from outside (e.g. from an Excel VBA module for example), then you do need explicit reference in this case.

Most of UI actions available to users are also available programmatically via Access object model.

Application Object

The top-level object.

CurrentDb Function

The entry to the DAO.Database and therefore to the DAO object model.

CurrentProject Object

Introduced in 2000, it provides additional and useful properties.

DoCmd Object

Represents a programmatic interface for most interactive actions that user may take in Access.

RunCommand

Typically specific to menu and ribbon items and simulates clicking such item. The action is also context-sensitive, meaning that you can only call it when it's available as if you were actually using it interactively. If at a moment, that item would be disabled (because the focus is on wrong object for example), the action will not be available.

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 3,511 times.  This page was last modified 18:16, 11 December 2011 by BananaRepublic.   Disclaimers