• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 28. Responding to Events with VB... > Referring to Access Objects with VBA

Referring to Access Objects with VBA

One of the reasons for using the term Access VBA in this book is that Access defines its own set of objects and uses specialized VBA syntax to refer to many Access objects. Although Form objects are common to most Office 2000 members as well as Visual Basic, a subform (a form embedded in a form) is unique to Access. You find Report objects and subreports only in Access. The syntax for referring to a subform or subreport and for referring to controls contained in a subform or subreport is unique to Access. Even if you're an experienced Visual Basic programmer, you must become acquainted with the new syntax to write VBA code and refer to objects that are unique to Access.

Referring to Open Forms or Reports and Their Properties

You can refer to a form or report only if it's open. Access uses the Forms and Reports collections to keep track of which forms and reports are open. The Forms collection is the set of open forms, and the Reports collection is the set of open reports. Because Access lets you use the same name for a form and a report, you must distinguish between the two by specifying the collection. The syntax for the reference is the collection name followed by the exclamation point operator (!), more commonly called the bang operator, and the name of the form or report:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint