ebook img

Microsoft Access VBA Macro Programming - dbmanagement.info PDF

400 Pages·2010·4.37 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Microsoft Access VBA Macro Programming - dbmanagement.info

Microsoft® Access 2010 ™ VBA Macro Programming About the Author Richard Shepherdhas worked for many years for major banks and corporations in the United Kingdom creating Access databases to solve specific problems. These companies include National Grid plc (electricity distribution), Hertz Car Leasing, NatWest plc (retail banking), Schroders plc (fund management), BNP Paribas (investment banking), Lloyds TSB plc (corporate banking), The Royal Bank of Scotland plc (investment banking), and the British National Health Service He has developed advanced databases for budgeting, business planning, trading reporting, and profit and loss reporting. He has qualified as an accountant with the Association of Chartered Certified Accountants and is now a Fellow of the Association. He is also the author ofExcel VBA Macro ProgrammingandExcel 2007 VBA Macro Programming(McGraw-Hill Professional). Richard works as a freelance software developer and can be contacted at [email protected]. About the Technical Editor Allen G. Tayloris a 30-year veteran of the computer industry and the author of 27 books, includingSQLforDummies,DatabaseDevelopmentforDummies,andCrystalReports2008for Dummies.Heteachesdatabasedevelopmentthroughaleadingonlineeducationprovider,and lecturesinternationallyonastronomy,history,innovation,andentrepreneurship.Hisblogaddress iswww.moontube.wordpress.com,andhiswebsitecanbefoundatwww.DatabaseCentral.Info. [email protected]. Microsoft® Access 2010 ™ VBA Macro Programming Richard Shepherd New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2011 by The McGraw-Hill Companies. All rights reserved. Except as permitted under the United States 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 the publisher. ISBN: 978-0-07-173858-3 MHID: 0-07-173858-4 The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-173857-6, MHID: 0-07-173857-6. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trade- marked name, we use names in an editorial fashion only, and to the benefi t of the trademark owner, with no intention of infringe- ment of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at [email protected]. Information has been obtained by McGraw-Hill from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill, or others, McGraw-Hill 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. TERMS OF USE This is a copyrighted work and The McGraw-Hill Companies, Inc. (“McGrawHill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED “AS IS.” McGRAW-HILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRAN- TIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw- Hill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise. To my wife, Elaine, and my son, Alexander. This page intentionally left blank Contents at a Glance Part I Programming in Access VBA Chapter 1 The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Chapter 2 Variables, Arrays, Constants, and Data Types . . . . . . . . . . . . . . . 13 Chapter 3 Modules, Functions, and Subroutines . . . . . . . . . . . . . . . . . . . . . 27 Chapter 4 Programming Basics: Decisions and Looping . . . . . . . . . . . . . . . . . 35 Chapter 5 Strings, Functions, and Message Boxes . . . . . . . . . . . . . . . . . . . 45 Chapter 6 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 Chapter 7 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Chapter 8 Errors and the Error Function . . . . . . . . . . . . . . . . . . . . . . . . . 91 Chapter 9 Forms and Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Chapter 10 Common Dialog Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Chapter 11 Working with the Ribbon . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Chapter 12 SQL Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Chapter 13 Table Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Part II Object Models Chapter 14 The Access Object Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Chapter 15 The Main Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 vii viii Microsoft Access 2010 VBA Macro Programming Chapter 16 The DoCmd Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Chapter 17 Using Access to Interact with Other Office Programs . . . . . . . . . . . 221 Part III Advanced Techniques in Access VBA Chapter 18 Charts and Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Chapter 19 Working with External Databases . . . . . . . . . . . . . . . . . . . . . . 239 Chapter 20 API Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 Chapter 21 Class Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Chapter 22 Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Part IV Access VBA in Action Chapter 23 Getting the Login ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 Chapter 24 Securing Your Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Chapter 25 Creating Audit Trails on Tables . . . . . . . . . . . . . . . . . . . . . . . . 289 Chapter 26 Creating and Editing Queries in VBA . . . . . . . . . . . . . . . . . . . . . 293 Chapter 27 Search and Replace in Queries . . . . . . . . . . . . . . . . . . . . . . . . 297 Chapter 28 Using the DateAdd Function . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Chapter 29 Monitoring Table Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . 305 Chapter 30 Handling Large Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 Chapter 31 Create and Change Table Structures . . . . . . . . . . . . . . . . . . . . . 313 Chapter 32 Create an Objects Inventory . . . . . . . . . . . . . . . . . . . . . . . . . 317 Chapter 33 Manipulate Chart Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 Chapter 34 Drill Down on Charts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 Chapter 35 Use Excel For Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 Contents at a Glance ix Chapter 36 Use FTP in VBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Chapter 37 What Happens When the 2-GB Limit Is Reached . . . . . . . . . . . . . . 343 Chapter 38 Creating Menu Structures with the Ribbon . . . . . . . . . . . . . . . . . 345 Chapter 39 Make Controls on Forms Interactive . . . . . . . . . . . . . . . . . . . . . 349 Chapter 40 Set Up Levels of User Security . . . . . . . . . . . . . . . . . . . . . . . . 355 Appendix ASCII Character Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365

Description:
More Exploring of the VBA Project Window In Access, Microsoft Access 2010 VBA Macro Programming. Microsoft Access 2010 VBA Macro Programming. Microsoft
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.