You are previewing Microsoft® Access™ VBA Programming for the Absolute Beginner, Third Edition.
O'Reilly logo
Microsoft® Access™ VBA Programming for the Absolute Beginner, Third Edition

Book Description

If you are new to programming with Microsoft Access VBA and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. Covering Access 2007, Microsoft Access VBA Programming for the Absolute Beginner focuses on VBA programming, but also covers beginning database concepts for those who lack that cursory knowledge of relational databases and/or Microsoft Access. Topics range from beginning SQL concepts, user interface upgrades, new data types, essential programming constructs, and much more. The book not only shows you how to apply the concepts learned to real-world Access 2007 scenarios, but by the time you finish the book, you'll be able to apply the basic principles learned to the next programming language you tackle.

Table of Contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. About the Author
  4. Introduction
    1. What You’ll Find in This Book
    2. Who This Book Is For
  5. 1. An Invitation to Access 2007
    1. What Is Microsoft Access?
    2. Microsoft Access 2007 Limitations
    3. Microsoft Office Suites
    4. System Requirements
    5. Working with Older Database Formats
    6. What’s New in Access 2007
      1. User Interface
      2. Templates
      3. Datasheet View
      4. Layout View
      5. Calendar
      6. Rich Text
      7. Split Forms
      8. Multivalued Fields
      9. Data Types
      10. File Format
      11. Help
    7. Summary
  6. 2. Access Essentials
    1. Database Normalization
      1. 1st Normal Form
      2. 2nd Normal Form
      3. 3rd Normal Form
    2. Creating a New Access 2007 Database
    3. Tables and Fields
    4. Table Relationships
    5. Forms
      1. Common Controls
      2. Hungarian Notation
    6. Queries
    7. Summary
  7. 3. Introduction to Access VBA
    1. The Event-Driven Paradigm
    2. Object-Based Programming
    3. The VBA IDE
      1. Introduction to Event Procedures
      2. Introduction to VBA Statements
    4. Accessing Objects and Their Properties
      1. The Forms Collection
      2. The Me Keyword
      3. Assignment Statements
      4. Command and Label Objects
      5. Getting User Input with Text Boxes
    5. Variables and Beginning Data Types
      1. Variable Naming Conventions
      2. Variable Scope
      3. Option Statements
    6. VBA Arithmetic and Order of Operations
    7. Chapter Program: Fruit Stand
    8. Summary
  8. 4. Conditions
    1. If Blocks
      1. Nested If Blocks
      2. Compound If Blocks
    2. Select Case Structures
    3. Dialog Boxes
      1. Message Box
      2. Input Box
    4. Common Controls Continued
      1. Option Group
      2. Option Buttons
      3. Check Boxes
      4. Toggle Buttons
    5. Chapter Program: Hangman
    6. Summary
  9. 5. Looping Structures
    1. Introduction to Looping Structures
      1. Do While
      2. Do Until
      3. Loop While
      4. Loop Until
      5. For
    2. List and Combo Boxes
      1. Adding Items
      2. Removing Items
      3. Managing Columns
    3. Random Numbers
    4. Chapter Program: Math Quiz
    5. Summary
  10. 6. Common Formatting and Conversion Functions
    1. String-Based Functions
      1. UCase
      2. LCase
      3. Len
      4. StrComp
      5. Right
      6. Left
      7. Mid
      8. InStr
    2. Date and Time Functions
      1. Date
      2. Day
      3. WeekDay
      4. Month
      5. Year
      6. Time
      7. Second
      8. Minute
      9. Hour
      10. Now
    3. Conversion Functions
      1. Val
      2. Str
      3. Chr
      4. Asc
    4. Formatting
      1. Formatting Strings
      2. Formatting Numbers
      3. Formatting Date and Time
    5. Chapter Program: Secret Message
    6. Summary
  11. 7. Code Reuse and Data Structures
    1. Code Reuse
      1. Introduction to User-Defined Procedures
      2. Subprocedures
      3. Function Procedures
      4. Arguments and Parameters
    2. Standard Modules
    3. Arrays
      1. Single-Dimension Arrays
      2. Two-Dimensional Arrays
      3. Dynamic Arrays
      4. Passing Arrays as Arguments
    4. User-Defined Types
      1. Type and End Type Statements
      2. Declaring Variables of User-Defined Type
      3. Managing Elements
    5. Chapter Program: Dice
    6. Summary
  12. 8. Debugging, Input Validation, File Processing, and Error Handling
    1. Debugging
      1. Stepping Through Code
      2. Breakpoints
      3. Immediate Window
      4. Locals Window
      5. Watch Window
    2. Input Validation
      1. IsNumeric
      2. Checking a Range of Values
    3. Error Handling
      1. The Err Object
      2. The Debug Object
    4. File Processing
      1. About Sequential File Access
      2. Opening a Sequential Data File
      3. Reading Sequential Data from a File
      4. Writing Sequential Data to a File
      5. Closing Data Files
      6. Error Trapping for File Access
    5. Chapter Program: Trivial Challenge
    6. Summary
  13. 9. Microsoft Access SQL
    1. Introduction to Access SQL
    2. Data Manipulation Language
      1. Simple SELECT Statements
      2. Conditions
      3. Computed Fields
      4. Built-In Functions
      5. Sorting
      6. Grouping
      7. Joins
      8. INSERT INTO Statement
      9. UPDATE Statement
      10. DELETE Statement
    3. Data Definition Language
      1. Creating Tables
      2. Altering Tables
      3. DROP Statement
    4. Summary
  14. 10. Database Programming with ADO
    1. ADO Overview
    2. Connecting to a Database
    3. Working with Recordsets
      1. Introduction to Database Locks
      2. Introduction to Cursors
      3. Retrieving and Browsing Data
      4. Updating Records
      5. Adding Records
      6. Deleting Records
    4. Chapter Program: Choose My Adventure
    5. Summary
  15. 11. Object-Oriented Programming with Access VBA
    1. Introduction to Object-Oriented Programming
    2. Creating Custom Objects
      1. Working with Class Modules
      2. Property Procedures
      3. Method Procedures
      4. Creating and Working with New Instances
    3. Working with Collections
      1. Adding Members to a Collection
      2. Removing Members from a Collection
      3. Accessing a Member in a Collection
      4. For Each Loops
    4. Chapter Program: Monster Dating Service
    5. Summary
  16. 12. Macros and Performance Tuning
    1. Macros
      1. Stand-Alone Macros
      2. Macro Troubleshooting and Error Handling
      3. Converting Macros to VBA
    2. Access Database Performance Considerations
      1. Forms
      2. VBA Code
      3. Queries and Indexes
      4. Performance Analyzer
    3. Summary
  17. A. Common Character Codes
  18. B. Keyboard Shortcuts for the Code Window
  19. C. Trappable Errors
  20. D. Visual Basic Environment Options
  21. E. Reserved Words and Symbols