Chapter 28. Responding to Events with VBA 5.0

All Windows applications are event-driven; event-driven 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, most of the Access VBA code you write consists of event-handling subprocedures—also called event procedures—that are contained within [{ Public | Private }] Sub {Form|Report}_[ ObjectName _] EventName ... End Sub structures of class modules. Class module is the new VBA term that replaces Access 2.0's and Access 95's use of code-behind-forms (CBF) to describe Access Basic or Access VBA code within a Form or Report container. This chapter describes how to write Access VBA event-handling code in Form and Report class modules to automate your Access 97 applications.

Prior 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, and some very large commercial Access applications made extensive use of macros. One of the major drawbacks of Access macros, however, was the inability to handle errors gracefully. Thus, most Access developers abandoned macros in favor of Access 1.x and 2.0, Access Basic, and Access 95 VBA. Now that all of the principal members of Microsoft Office offer VBA, Access macros are on their way to oblivion. There's no guarantee that future versions of Access will continue to support Access macros. Thus, this chapter also shows you how to convert Access macros to VBA code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.16.184