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

Chapter 28. Responding to Events with VB... > Introducing Event-Driven Programming

Introducing Event-Driven Programming

All Windows applications are event-driven, which means that an event, such as a mouse click on a command button or a change in the position of a record pointer, executes individual blocks of application programming code. Thus, the majority of the VBA code you write consists of event-handling subprocedures—also called event procedures or event handlers—that are contained within [{Public|Private}] Sub {Form|Report}_[ObjectName_]EventName End Sub structures of class modules. Class module is the VBA term that replaces Access 2.0's and Access 95's use of code-behind-forms (CBF) to describe Access Basic or Access-specific VBA code embedded within a Form or Report container. In the preceding chapter, you took advantage of the Form_Load event to execute VBA code to open and manipulate Recordset objects. This chapter describes how to write Access VBA event-handling code in Form and Report class modules to automate your Access 2000 applications.

Early versions of Access emphasized the use of Access macros to respond to events. Microsoft promoted Access macros as a simplified programming language for users with little or no programming experience. The repertoire of approximately 40 Access macro actions proved adequate to automate relatively simple applications. One of the major drawbacks of Access macros is the inability to handle errors gracefully. Thus, virtually all Access developers have abandoned macros in favor of programming. Now that all the principal members of Microsoft Office offer VBA and use the same VBA Editor, Access macros are on their way to oblivion. There's no guarantee that future versions of Access will continue to support Access macros.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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