Microsoft Access 2000 Power Programming.pdf

(14505 KB) Pobierz
F. Scott Barker's Microsoft Access 2000 Power Programming:Table of Contents
To access the contents, click the chapter and section titles.
F. Scott Barker's Microsoft Access 2000 Power Programming
(Publisher: Macmillan Computer Publishing)
Author(s): F. Scott Barker
ISBN: 0672315068
Publication Date: 06/11/99
Search this book:
CHAPTER 1—Macros Are for Weenies; Code
Is Cool!
Understanding Where Macros End and Code Begins
When Are Macros Necessary?
When Is Code Necessary?
Looking at Macro-to-Code Changes
Using the DoCmd Object
Code Equivalents of Macro Commands
Converting Existing Macros to VBA Code
Summary
CHAPTER 2—Coding in Access 2000 with VBA
Getting Started with Programming
Using Code Modules
Declaring Variables
Declaring Procedures
Controlling Program Flow
Commenting Code
2746151.010.png 2746151.011.png 2746151.012.png 2746151.013.png 2746151.001.png 2746151.002.png 2746151.003.png 2746151.004.png 2746151.005.png
Handling Errors
Programming Style Used Throughout This Book
Getting Started with VBA
Introducing Objects
Using the Object Browser
Programming with Objects
The Public Keyword
The Private Keyword
Using Properties and Methods
Using Existing Properties
Using Existing Methods
Specifying Named Parameters
Assigning Objects to Variables
Using Collections
Counting the Number of Elements
Accessing Elements of the Collection
Iterating over Collections
Customizing a Form
Writing Custom Properties
Writing Object-Valued Properties
Writing Custom Methods
Coding Class Modules
Creating the Support Objects
Creating the Class Module
Using the Class Module
Summary
CHAPTER 3—Making the Choice: MDB or
ADP, DAO or ADO
Using Microsoft Database Versus Access Database
Project
Looking at the Objects Used in Each
Using Data Access Objects Versus Activex Data Objects
Summary
CHAPTER 4—Looking at the Access
Collections
2746151.006.png
Creating Custom Collections
Defining a New Collection
Adding Items to the Collection
Removing Items from the Collection
Comparing Custom Collections to Arrays
Creating a Collection of Integers
Creating an Array of Integers
Understanding Advanced Uses of Collections
Accessing the Access Object Model
Using the Application Object
Looking at the References Collection
Working with the Forms and Reports Collections
Programming Multiple Copies of the Same Form
Supporting Multiple-Form Instances
Examining the Employees Form’s Code
Closing the Employees Forms Automatically
Summary
CHAPTER 5—Working with Data Access
Objects
Understanding Data Access Objects
Understanding the Anatomy of Your Database
Getting Started with DAO
Getting into Your Database
Examining Your Database
Examining Table Attributes
Examining Query Types
Creating a Database with DAO
Creating the Database Object
Copying Table Structures
Fielding the Field Object
Copying Queries
Copying Relationships
Copying Data
Increasing Speed with Transactions
Using Custom Properties
Summary
2746151.007.png
CHAPTER 6—Introducing Activex Data
Objects
Looking at the Object Models
The ActiveX Data Objects 2.1 (ADODB) Object
Model
The ADO Extensions 2.1 for DDL and Security
(ADOX) Object Model
Jet and Replication Objects 2.1 (JRO) Object
Model
Referencing the Type Libraries
Opening a Connection to a Database
Connecting to the Current Database
Connecting to Another Database
Creating a Recordset with ADO
Opening a Simple Recordset
Looping Through and Editing Recordsets
Creating Persistent Recordsets
Using the RecordCount, BOF, and EOF
Properties
Checking to See What Operations a Recordset
Will Support
Cloning Recordsets
Bookmarks
Working with Queries Using ADO
Creating a New Query
Creating a Parameterized Query
Opening a Recordset off a Parameterized Query
Executing Bulk Queries
Modifying an Existing Query
Deleting a Query
Working with Tables Using ADO
Looking at the Tables Collection
Creating a New Table with Fields and Indexes
Modifying an Existing Table by Adding an Index
Summary
CHAPTER 7—Handling Your Errors in Access
2746151.008.png
with VBA
Access Error Messaging
Different Ways of Using Error Handling
Examining Access’s Runtime Error Handling
Using the On Error Command
Using the Exit Sub|Function Command
Using Resume, Resume Next, and Resume
LineLabel
Working with the Err and Error Objects
The Err Object’s Clear Method
The Err Object’s Raise Method
Working with the Errors Collection
Creating User-Defined Errors
Tracking Errors by Using a Custom Error Log
The Declarations Section for Error Log Routines
An Example Error Handler Calling the Error
Log
The Information Tracked for Each Error
Examining the Actual Error Log Code
Logging to the Back End First, or Front End if
Necessary
Updating the Back End with Any Errors That
Occur
Creating a Centralized Error-Handling Routine
A Last Look at Error-Handling Issues
Watching for Environment Switches
Using Your Error Handler to Roll Back
Transactions
Using a Form’s On Error Event
Nesting Error Handlers
Looking at Some New Options for Error
Handling
Summary
CHAPTER 8—Using Queries to Get the Most
2746151.009.png
Zgłoś jeśli naruszono regulamin