Wiley.com
Print this page Share

Access 2003 VBA Programmer's Reference

ISBN: 978-0-7645-5903-7
Paperback
984 pages
April 2004
Access 2003 VBA Programmer's Reference (0764559036) cover image
This product is not currently available for purchase from this website.
For customer care, special sales, or to find your rep, please visit our Contact Us page.
Other Available Formats: E-book

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.
01/03/07

Related Titles

More By These Authors

Database & Data Warehousing Technologies

by Rick Greenwald, Robert Stackowiak, Gary Dodge, David Klein, Ben Shapiro, Christopher G. Chelliah
by Paul Wilton, John Colby
by Sivakumar Harinath, Stephen R. Quinn
Back to Top