Access VBA Macro Programming

(Joao Candeias) #1

Chapter 15 The Main Objects


Chapter 15 The Main Objects


I


n the preceding chapter, we looked at the object models in terms of how they work, the
hierarchy, and passing parameters. In this chapter, we’ll look in more detail at the main
collections and objects that you will be using within your code to communicate with
the application and the database.
The objects discussed areApplication,Me,CurrentDb, andRecordset.


Application Object


TheApplicationobject is at the highest point in the hierarchy of the object model and
represents the whole Access application. It contains all the objects for the active Access
application including DAOs (Data Access Objects). It also contains several useful functions
for returning data from tables and queries, similar to the filters you would use.
You can also use it to quit the Access application and close down completely. The Application
object is the default object and does not have to be specified within the syntax of the statement.
For example, the following statement can be used to get the name of the first printer in the Printers
collection:


Printers( 0 ).DeviceName


Main Properties, Methods, and Collections


This section details the main properties, methods, and collections you will use within the
Application object.


193

Free download pdf