Microsoft Access VBA Macro Programming

400 Pages · 4.37 mb ·

Programming

Table of contents

- Contents (Page 12)
- Acknowledgments (Page 22)
- Introduction (Page 24)
- Part I: Programming in Access VBA (Page 28)
- Chapter 1 The Basics (Page 30)
- Macros and VBA Modules in Access (Page 30)
- Exploring the Visual Basic Editor in Access (Page 31)
- Saving Your Code (Page 39)
- Chapter 2 Variables, Arrays, Constants, and Data Types (Page 40)
- Variables (Page 40)
- Data Types (Page 45)
- VBA Data Types (Page 47)
- Arrays (Page 49)
- User-Defined Types (Page 51)
- Constants (Page 52)
- Reserved Words (Page 53)
- Chapter 3 Modules, Functions, and Subroutines (Page 54)
- Modules (Page 54)
- The Difference Between Subroutines and Functions (Page 55)
- Writing a Simple Subroutine (Page 56)
- Writing a Simple Function (Page 57)
- Public and Private Functions and Subroutines (Page 59)
- Argument Data Types (Page 60)
- Optional Arguments (Page 60)
- Passing Arguments by Value (Page 60)
- Chapter 4 Programming Basics: Decisions and Looping (Page 62)
- Decisions (Page 63)
- Looping (Page 67)
- Chapter 5 Strings, Functions, and Message Boxes (Page 72)
- Strings (Page 72)
- Functions (Page 76)
- Conversion Functions (Page 78)
- Format Function (Page 79)
- Date and Time Functions (Page 83)
- The SendKeys Command (Page 89)
- Message Boxes (Page 93)
- Chapter 6 Operators (Page 98)
- Arithmetic Operators (Page 99)
- Comparison Operators (Page 101)
- Concatenation Operator (Page 102)
- Logical Operators (Page 102)
- Other Operators (Page 106)
- Chapter 7 Debugging (Page 108)
- Types of Errors (Page 108)
- Design Time, Runtime, and Break Mode (Page 109)
- Breakpoints (Page 111)
- Using Stop Statements (Page 111)
- Running Selected Parts of Your Code (Page 111)
- The Debug Window (Page 113)
- Events That Can Cause Problems When Debugging (Page 115)
- Using Message Boxes in Debugging (Page 116)
- Avoiding Bugs (Page 117)
- Chapter 8 Errors and the Error Function (Page 118)
- The Resume Statement (Page 120)
- Implications of Error Trapping (Page 121)
- Generating Your Own Errors (Page 121)
- Chapter 9 Forms and Reports (Page 124)
- Forms (Page 124)
- Reports (Page 141)
- Chapter 10 Common Dialog Control (Page 150)
- The Open File Dialog (Page 151)
- The Print Dialog (Page 155)
- Chapter 11 Working with the Ribbon (Page 156)
- Creating a Ribbon Customization (Page 157)
- Using the Custom UI Editor (Page 159)
- Creating Code for Your Custom Buttons (Page 163)
- Images (Page 165)
- How Can You Use VBA Code with the Ribbon (Page 165)
- More on the Ribbon (Page 168)
- Chapter 12 SQL Queries (Page 176)
- Using the Query Design Window (Page 177)
- Select Query (Page 181)
- Union Query (Page 183)
- The Delete Query (Page 184)
- Make Table Query (Page 185)
- Append Query (Page 186)
- Update Query (Page 188)
- Pass-Through Query (Page 190)
- Using Custom Functions within Queries (Page 190)
- Chapter 13 Table Macros (Page 192)
- Creating a Table Macro (Page 192)
- Part II: Object Models (Page 200)
- Chapter 14 The Access Object Models (Page 202)
- Properties and Methods Explained (Page 203)
- Using the Object Browser (Page 211)
- Hierarchy (Page 217)
- Chapter 15 The Main Objects (Page 220)
- Application Object (Page 220)
- Me Object (Page 228)
- CurrentDb Object (Page 232)
- Recordset Object (Page 234)
- Chapter 16 The DoCmd Object (Page 240)
- DoCmd Methods (Page 240)
- Chapter 17 Using Access to Interact with Other Office Programs (Page 248)
- Driving Microsoft Outlook (Page 251)
- Driving Access from Other Office Programs (Page 253)
- Part III: Advanced Techniques in Access VBA (Page 256)
- Chapter 18 Charts and Graphs (Page 258)
- Working with the Series Collection Object (Page 263)
- Exporting a Chart as a Picture File (Page 264)
- Chapter 19 Working with External Databases (Page 266)
- Linking to Other Access Databases (Page 267)
- ODBC Links and DSNs (Page 267)
- Using a DSN (Page 270)
- Problems Using Linked Tables (Page 272)
- Using Pass-Through Queries (Page 273)
- Using ADO (Page 275)
- Chapter 20 API Calls (Page 280)
- What Is an API Call? (Page 280)
- Using an API Call (Page 281)
- Chapter 21 Class Modules (Page 292)
- Creating a Data Services Layer (Page 293)
- Inserting a Class Module (Page 293)
- Creating an Object (Page 294)
- Creating a Collection (Page 295)
- Using the PNames Collection (Page 297)
- Using the PNames Collection as a Multi-tier Application (Page 299)
- Chapter 22 Animation (Page 300)
- Part IV: Access VBA in Action (Page 304)
- Chapter 23 Getting the Login ID (Page 306)
- A Simple Use of the User Name (Page 308)
- Chapter 24 Securing Your Database (Page 310)
- Using an ACCDE File to Protect Your Application (Page 310)
- Using VBA to Lock Your Application Down (Page 311)
- Chapter 25 Creating Audit Trails on Tables (Page 316)
- Who Is the User? (Page 316)
- The Audit Trail on the Table Structure (Page 317)
- Chapter 26 Creating and Editing Queries in VBA (Page 320)
- Creating a New Query (Page 320)
- Deleting an Existing Query (Page 321)
- Updating a SQL Query (Page 321)
- Chapter 27 Search and Replace in Queries (Page 324)
- Searching for a Specific String Within All Queries (Page 324)
- Search and Replace in a Query (Page 326)
- Chapter 28 Using the DateAdd Function (Page 328)
- Using DateAdd to Pause Your Code (Page 330)
- Chapter 29 Monitoring Table Statistics (Page 332)
- Chapter 30 Handling Large Text Files (Page 334)
- Chapter 31 Create and Change Table Structures (Page 340)
- Creating a Table (Page 340)
- Deleting a Table or a Field (Page 341)
- Editing Field Properties (Page 342)
- Creating Indexes (Page 342)
- Chapter 32 Create an Objects Inventory (Page 344)
- Chapter 33 Manipulate Chart Colors (Page 348)
- Chapter 34 Drill Down on Charts (Page 352)
- Chapter 35 Use Excel For Output (Page 356)
- Using a Recordset to Create a Spreadsheet (Page 356)
- Using an Existing Spreadsheet as a Template (Page 357)
- Transferring Individual Numbers to Excel (Page 359)
- Allowing Users to Design Their Excel Reports (Page 360)
- Chapter 36 Use FTP in VBA (Page 364)
- Using VBA Code to Transfer Files (Page 365)
- Use of Semaphore Files (Page 367)
- Chapter 37 What Happens When the 2-GB Limit Is Reached (Page 370)
- Chapter 38 Creating Menu Structures with the Ribbon (Page 372)
- Chapter 39 Make Controls on Forms Interactive (Page 376)
- Creating a Simple Table (Page 377)
- Creating a Form for the Table (Page 378)
- Chapter 40 Set Up Levels of User Security (Page 382)
- Appendix: ASCII Character Codes (Page 386)
- Index (Page 392)
- A (Page 392)
- B (Page 393)
- C (Page 393)
- D (Page 393)
- E (Page 394)
- F (Page 395)
- G (Page 395)
- H (Page 396)
- I (Page 396)
- K (Page 396)
- L (Page 396)
- M (Page 396)
- N (Page 397)
- O (Page 397)
- P (Page 397)
- Q (Page 398)
- R (Page 398)
- S (Page 398)
- T (Page 399)
- U (Page 399)
- V (Page 399)
- W (Page 400)
- X (Page 400)
- Y (Page 400)