Access VBA programming (2004)

639 125 0
Access VBA programming (2004)

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Access VBA Programming ISBN:0072231971 by Charles E Brown and Ron Petrusha McGraw-Hill/Osborne © 2004 (441 pages) From the basics to advanced techniques, this comprehensive reference demonstrates how to connect Access and VBA through ADO, how to extract, manipulate, and retrieve data using SQL queries, benefit from expert advice on error handling, and much more Table of Contents Access VBA Programming Introduction Part I - Understanding the MS Access Environment Chapter 1 Chapter 2 Chapter 3 Chapter 4 - Introduction to VBA for Applications - Designing an Access Application - Access Development Without VBA - Customizing the Access Environment Part II - Understanding the Visual Basic for Applications Environment Chapter 5 - Introducing the VBA Programming Environment Chapter 6 - Programming Fundamentals Using VBA Chapter 7 - Understanding the Visual Basic Editor Chapter 8 - VBA Language Components Chapter 9 - Sub Procedures Chapter 10 - Debugging VBA Code Chapter 11 - Function Procedures Part III - Interacting with VBA Chapter 12 - Forms Chapter 13 - Reports Chapter 14 - Menus and Toolbars Chapter 15 - Changing the Access Environment Part IV - Advanced Access Programming Techniques Chapter 16 - Database Security Chapter 17 - Access and the Microsoft Office Environment Chapter 18 - Access and the Web Chapter 19 - Upgrading Part V - Application Development Chapter 20 - Multiuser Applications Chapter 21 - Beyond Microsoft Access Appendix - The DoCmd Object Index List of Figures List of Tables Back Cover Expand the range of your Access proficiency with VBA programming, using this guide designed specifically for Access power users Learn VBA fundamentals, then discover how to connect Access and VBA through ActiveX Data Objects (ADO), and how to extract, manipulate, and retrieve data using SQL queries Benefit from expert advice on error handling, get the most out of forms, reports, and tables, and save time with VBA coding and debugging tips From the basics to advanced techniques, this comprehensive treatment provides you with the information you need to produce the exact results you desire Call up forms and reports using VBA Build dynamic Data Access Pages Program and assign record data sources to forms and reports Learn the fundamentals of SQL and how to use it in VBA Understand the ADO object model and its components Use modules, declare variables, build looping and decision structures, use procedures and functions, and build arrays Generate recordsets based on dynamic criteria Use Office menus and toolbars to invoke your code Develop applications that multiple users can run at the same time About the Authors Charles E Brown has taught VBA programming to many beginner programmers, and has produced VBA code for Swiss Bank Corporation, the US government, NASA, and Price Waterhouse Accounting Ron Petrusha is a computer book author and editor with over 25 years of experience in developing computer applications Access VBAProgramming Charles E Brown Ron Petrusha McGraw-Hill/Osborne2100 Powell Street, 10th FloorEmeryville, California 94608U.S.A To arrange bulk purchase discounts for sales promotions, premiums, or fund-raisers, please contact McGraw-Hill/Osborne at the above address For information on translations or book distributors outside the U.S.A., please see the International Contact Information page immediately following the index of this book Access VBA Programming Copyright © 2004 by The McGraw-Hill Companies All rights reserved Printed in the United States of America Except as permitted under the Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of publisher, with the exception that the program listings may be entered, stored, and executed in a computer system, but they may not be reproduced for publication 1234567890 FGR FGR 01987654 ISBN 0-07-223197-1 Publisher Brandon A Nordin Vice President & Associate Publisher Scott Rogers Editorial Director Wendy Rinaldi Project Editor Carolyn Welch Acquisitions Coordinator Athena Honore Technical Editor David Schulz Copy Editor Judith Brown Proofreader Marian Selig Indexer Claire Splan Composition Lucie Ericksen John Patrus Kelly Stanton-Scott Illustrators Kathleen Edwards Melinda Lytle Greg Scott Series Design Roberta Steele Cover Design Tom Slick This book was composed with Corel VENTURA™ Publisher Information has been obtained by McGraw-Hill/Osborne from sources believed to be reliable However, because of the possibility of human or mechanical error by our sources, McGraw-Hill/Osborne, or others, McGraw-Hill/Osborne does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information About the Authors Charles E Brown is one of the most noted authors, teachers, and consultants in the computer industry today His first two books, Beginner Dreamweaver MX and Fireworks MX: Zero to Hero, have received critical acclaim and are consistent bestsellers This year, Charles will be releasing books on VBA for Microsoft Access, and the new Microsoft FrontPage environment He is also a Fireworks MX contributor for the MX Developer’s Journal In addition to his busy writing schedule, he conducts frequent seminars for Future Media Concepts, speaking about the Macromedia development environment In 2004, he will also be involved in developing e-learning courses using Macromedia’s RoboDemo development environment When Charles is not writing and teaching, he is a consultant for many high-profile websites This year, he is placing a lot of his web development efforts with the Flash MX 2004 Professional environment He feels strongly that this is the future of web development Charles is also a noted classical organist, pianist, and guitarist who studied with such notables as Vladimir Horowitz, Virgil Fox, and Igor Stravinsky It was because of his association with Stravinsky that he got to meet, and develop a friendship with, famed 20th-century artist Pablo Picasso Ron Petrusha has over 25 years of experience in the computer industry and is the author of ten computer books and numerous print and online articles He is the principal of Howling Wolf Consulting Services, a company that provides editorial services to the publishing industry and also offers application and web development services using Microsoft technologies He can be reached at ron@howlingwolfconsulting.com Introduction Overview Before the introduction of Microsoft Access, database management systems were synonymous with programming Without programming, you were unable to tap into the full power of the software Indeed, some database management systems, like Nantucket Corporation’s Clipper, consisted only of a development environment and a compiler The database developer was responsible for designing the databases and then writing all of the code that constituted his or her application The introduction of Microsoft Access in 1991 changed all that Access was distinguished by its graphical approach to database management, which allowed users to take advantage of some powerful features of the DBMS without needing to do any programming By using wizards and graphical designers, Access allowed users to design databases, create forms and user interfaces, write queries, and generate reports It was this power and flexibility combined with its ease of use that quickly made Access the leading desktop database management system Although programming is not required to use Access, nevertheless, Access has attracted a huge programming audience In fact, more programmers are working with Access than with any other database management system There are two major reasons for this apparent contradiction: By providing such an effective rapid application development environment for database applications, Access prompts users to want to learn more about using the software more powerfully, effectively, and efficiently In fact, many professional Access programmers began as Access users who developed a passion for the product and experienced a frustration over the things they wanted to do but didn’t know how to do Despite its ease of use, users at some point run into the limitations of the Access user interface and must turn to programming Although you can do a great deal as an Access user, some things can only be done programmatically If you’ve picked up this book, you’re no doubt an Access user who has had both of these experiences You enjoy using Access, enjoy the power that it places at your disposal, and want to learn more about using it effectively At the same time, you find that you’re running into some of the limitations of the Access interface and suspect that if you’re to continue to deepen your skills in using Access, you need to turn to programming And perhaps you’re even beginning to find yourself responsible for developing and maintaining Access applications, possibly in a small business setting, where most users have very little experience with the Access interface In that case, this book is for you Access VBA Programming takes the Access power user to the next level, from using Access to programming with Access, by building on much of what you already know Part I, “Understanding the Access Environment,” introduces some of the basic concepts of program design and architecture (like requirements analysis and naming conventions) at the same time that it reviews what you can do in Access without programming It includes a refresher course on the major components of an Access application (including macros, modules, and events), as well as a discussion of some of the interface elements you can eventually use to allow yourself and other users access to the code you’ll eventually write This includes using the Switchboard Manager as the menu system of an Access application and customizing Access menus and toolbars so that the user can execute routines by clicking a toolbar button or selecting a menu item Part II, “Understanding the Visual Basic for Applications Environment,” introduces you to Visual Basic for Applications (VBA), the programming language used by Microsoft Access (as well as by the other Office applications and by Visual Basic) Here you’ll learn about basic programming concepts, such as variables, arrays, objects, program structures (looping structures, decision-making structures), functions, and procedures VBA, however, offers not only a programming language, but a complete integrated development environment (IDE) that allows you to run, test, and debug your code This part of the book introduces you to the VBA Editor, VBA’s IDE Finally, VBA itself has no language elements Chapter 15: Changing the Access Environment Figure 15-1: The database startup properties dialog box Figure 15-2: The Startup dialog box with fields clicked off Figure 15-3: Options dialog box Chapter 16: Database Security Figure 16-1: The Startup dialog box Figure 16-2: The Project Properties Protection dialog box Figure 16-3: Workgroup Administrator Figure 16-4: Workgroup Owner Information Figure 16-5: Confirm Workgroup dialog box Figure 16-6: User and Group Accounts Figure 16-7: User and Group Permissions Figure 16-8: Macro Security dialog box Figure 16-9: Opening screen to create a digital certificate Figure 16-10: Digital Signature attachment box Figure 16-11: List of available certificates Figure 16-12: The digital certificate Figure 16-13: Security Warning box Chapter 17: Access and the Microsoft Office Environment Figure 17-1: The Microsoft Office Object Library reference Figure 17-2: The References dialog box Chapter 18: Access and the Web Figure 18-1: The Pages window Figure 18-2: First step in the Page Wizard Figure 18-3: Step 2 of the Page Wizard Figure 18-4: Step 3 of the Page Wizard Figure 18-5: Final step of the Page Wizard Figure 18-6: A Data Access Page Figure 18-7: The Microsoft Script Editor Figure 18-8: Save As Data Access Page Figure 18-9: The Pages window with the new object Figure 18-10: The Data Access Page Design window Figure 18-11: The Data Access Page Design window with a field added Figure 18-12: Relationship Wizard window Figure 18-13: Properties for a Data Access Page Chapter 19: Upgrading Figure 19-1: Table Design window in SQL Server Figure 19-2: The Database window in the ADP file Figure 19-3: The Queries category Figure 19-4: The stored procedure designer Figure 19-5: Saving a stored procedure Figure 19-6: The View Properties dialog box Chapter 20: Multiuser Applications Figure 20-1: Advanced tab of the Options dialog box Figure 20-2: Save Backup As dialog box Figure 20-3: First screen of the Database Splitter Wizard Figure 20-4: The Database Splitter Wizard’s Create Back-end Database dialog box Figure 20-5: The Tables window of a front-end database Figure 20-6: Linked Table Manager dialog box Figure 20-7: The Paste Table As dialog box Chapter 21: Beyond Microsoft Access Figure 21-1: The VBA Editor in Excel Figure 21-2: The References dialog box in Excel Figure 21-3: The Customer table in Excel Figure 21-4: Excel’s Customize dialog box Figure 21-5: The Visual Basic References dialog box Figure 21-6: A Standard EXE project in Visual Basic Figure 21-7: Controls tab of the Components dialog box Figure 21-8: Toolbox with the ADO Data Control added Figure 21-9: The first step toward building a connection string Figure 21-10: Selecting a data provider Figure 21-11: Selecting a database for the connection Figure 21-12: The finished form in design mode Figure 21-13: The finished application Figure 21-14: Output from an Active Server Page built with VBScript List of Tables Chapter 3: Access Development Without VBA Table 3-1: Object-Identifying Prefixes Chapter 6: Programming Fundamentals Using VBA Table 6-1: Types of Variables Table 6-2: Variable Prefixes Chapter 9: Sub Procedures Table 9-1: ADO Equivalents to Access Data Types Chapter 11: Function Procedures Table 11-1: Buttons and Icons in the MsgBox Function Chapter 15: Changing the Access Environment Table 15-1: VBA Equivalents of Startup Properties Chapter 20: Multiuser Applications Table 20-1: Effect of Locking Schemes when Two Users Edit the Same Record Table 20-2: Effect of Locking When Two Users Edit Different Records Table 20-3: Parameters and Values for the SetOption Method Chapter 21: Beyond Microsoft Access Table 21-1: Properties of the ADO Data Control Table 21-2: Setting the Properties and Values for the Controls ... power and flexibility combined with its ease of use that quickly made Access the leading desktop database management system Although programming is not required to use Access, nevertheless, Access has attracted a huge programming audience In fact, more... developing and maintaining Access applications, possibly in a small business setting, where most users have very little experience with the Access interface In that case, this book is for you Access VBA Programming takes the Access power user to the next level,... Access VBA Programming takes the Access power user to the next level, from using Access to programming with Access, by building on much of what you already know Part I, “Understanding the Access Environment,”

Ngày đăng: 25/03/2019, 16:43

Từ khóa liên quan

Mục lục

  • Table of Contents

  • BackCover

  • Access VBAProgramming

  • Introduction

    • Who Should Read This Book?

    • Part I: Understanding the MS Access Environment

      • Chapter 1: Introduction toVBA for Applications

        • History of Microsoft Access

        • Developing in Access

        • The Future of Microsoft Access

        • Summary

        • Chapter 2: Designing anAccess Application

          • Steps in the Development Process

          • Definition and Analysis of Requirements

          • Evaluation of Requirements

          • Development of the Design

          • Implementation and Testing

          • Documentation

          • Maintenance

          • Summary

          • Chapter 3: Access DevelopmentWithout VBA

            • System Architecture

            • Understanding a Database Application

            • Working Without VBA

            • Events

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan