Wrox Home  
Access 2003 VBA Programmer's Reference (0764559036) cover image

Access 2003 VBA Programmer's Reference

Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein
ISBN: 978-0-7645-5903-7
984 pages
April 2004
This title is out-of-print and not currently available for purchase from this site.

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
87 Replacement Code
At the bottom of page, last 2 sentences: should be: The following code sample illustrates how both the declaration and itís location affect a variableís scope and lifetime.
Option Explicit 'Used to require variable declaration

Public txtCustomerName as String 'Scope is entire application
Private txtVendor as String 'Scope is any procedure in this module
Dim txtSupplier as String 'Scope is the current module

Private Sub GetCustomerName()
Dim txtCustomer as String 'Scope is limited to this sub
End Sub
You might be wondering why the two statements that begin with Dim have different scopes. Use of the Dim keyword in the General Declarations section sets the scope of the variable to the module, so it can be used by any procedure in that module.. In the previous listing, txtVendor and txtSupplier are both module-level variables. They can be used anywhere within the module and anytime the module is loaded. txtCustomerName is a global variable. It can be used anywhere within any procedure in the application.
Printer-Ready Version   Share This
With you wherever you go: pdf + ePub + kindle -- DRM-free