® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.

Slides:



Advertisements
Similar presentations
Access Lesson 13 Programming in Access Microsoft Office 2010 Advanced Cable / Morrison 1.
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Developing an Excel Application
Tutorial 8: Developing an Excel Application
XP New Perspectives on Microsoft Excel 2003, Second Edition- Tutorial 8 1 Microsoft Office Excel 2003 Tutorial 8 – Developing an Excel Application.
Microsoft Office 2007 Microsoft Excel Collaboration Feature Using SharePoint and Excel Services.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
The Web Warrior Guide to Web Design Technologies
® Microsoft Access 2010 Tutorial 5 Creating Advanced Queries and Enhancing Table Design.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA By Robert T. Grauer Maryann Barber.
String Variables Visual Basic for Applications 4.
Exploring Office Grauer and Barber 1 Creating More Powerful Applications: Introduction to VBA(Wk9)
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
SUNY Morrisville-Norwich Campus-Week 12 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Using the Visual Basic Editor Visual Basic for Applications 1.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
COMPREHENSIVE Excel Tutorial 8 Developing an Excel Application.
Access Tutorial 10 Automating Tasks with Macros
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Visual Basic Chapter 1 Mr. Wangler.
® Microsoft Access 2010 Tutorial 6 Using Form Tools and Creating Custom Forms.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
® Microsoft Access 2010 Tutorial 7 Creating Custom Reports.
Project 9 Using Visual Basic for Applications (VBA) to Customize and Automate Excel Jason C. H. Chen, Ph.D. Professor of Management Information Systems.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Microsoft Excel 2007 © Wiley Publishing All Rights Reserved. The L Line The Express Line to Learning L Line.
XP Chapter 7 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Enhancing User Interaction Through Programming Chapter.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Enhancing User Interaction Through Programming
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Introduction to VBA MGMI Aug What is VBA? VBA = Visual Basic for Application Excel’s powerful built-in programming language An event-driven.
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
Chapter 11: Introduction to the Visual Basic Environment Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Using Visual Basic for Applications (VBA) – Project 8.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 11 Committed to Shaping the Next Generation of IT Experts. Chapter 10 Customizing a Database.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
OCC Network Drives  H:\  P:\ 
The Object Model Visual Basic for Applications 2.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
Chapter 4 - Visual Basic Schneider1 Chapter 4 General Procedures.
® Microsoft Access 2010 Tutorial 10 Automating Tasks with Macros.
Access Lesson 11 Creating and Running Macros Microsoft Office 2010 Advanced Cable / Morrison 1.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
® Microsoft Access 2010 Tutorial 5 Creating Advanced Queries and Enhancing Table Design.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Excel Tutorial 8 Developing an Excel Application
Access Project 8 Using Visual Basic for Applications (VBA) and Creating Multi-Page Forms.
Microsoft Access Illustrated
Microsoft Office Illustrated
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Exploring Microsoft Office Access 2007
Microsoft Office Excel 2003
Tutorial 10 Automating Tasks with Macros
Tutorial 11 Using and Writing Visual Basic for Applications Code
Presentation transcript:

® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code

XP New Perspectives on Microsoft Access Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event procedure Create a function in a standard module Test a procedure in the immediate window Create event procedures Compile and test functions, subroutines, and event procedures Hide text and change display colors

XP VBA Code Window New Perspectives on Microsoft Access 20103

XP Introduction to Visual Basic for Applications Visual Basic for Applications (VBA) is the programming language provided with Access and other Office programs VBA has a common syntax and a set of common features for all Microsoft Office programs – Event-driven language – Object-oriented language New Perspectives on Microsoft Access 20104

XP Events New Perspectives on Microsoft Access 20105

XP Procedures A Function procedure, or function, performs operations, returns a value, accepts input values, and can be used in expressions (recall that an expression is a calculation resulting in a single value) A Sub procedure, or subroutine, performs operations and accepts input values, but does not return a value and cannot be used in expressions New Perspectives on Microsoft Access 20106

XP Modules New Perspectives on Microsoft Access 20107

XP Modules Declarations section Standard module Public procedure Class module Local procedure Private procedure New Perspectives on Microsoft Access 20108

XP Using an Existing Procedure New Perspectives on Microsoft Access 20109

XP Creating a New Standard Module Click the Create tab on the Ribbon In the Macros & Code group on the Create tab, click the Module button. A new Code window opens in the Visual Basic window New Perspectives on Microsoft Access

XP Creating a Function Each function begins with a Function statement and ends with an End Function statement – Parameter – Argument New Perspectives on Microsoft Access

XP Testing a Procedure in the Immediate Window In the Code window, click View on the menu bar, and then click Immediate Window to open the Immediate window Type a question mark (?), the procedure name, and the procedure’s arguments in parentheses. If the argument contains a string of characters, enclose the argument in quotation marks Press the Enter key and verify the displayed answer New Perspectives on Microsoft Access

XP Testing a Procedure in the Immediate Window New Perspectives on Microsoft Access

XP Event Procedure New Perspectives on Microsoft Access

XP Creating an Event Procedure New Perspectives on Microsoft Access

XP Designing the Event Procedure New Perspectives on Microsoft Access

XP Adding an Event Procedure to a Form or Report Open the form or report in Design view, select the control whose event property you want to set, open the property sheet for the control, and then click the Event tab in the property sheet Click the event property box, click its Build button, click Code Builder in the Choose Builder dialog box, and then click the OK button Enter the subroutine statements in the Code window Compile the procedure, fix any statement errors, and then save the event procedure New Perspectives on Microsoft Access

XP Adding an Event Procedure to a Form or Report New Perspectives on Microsoft Access

XP Compiling Modules The process of translating modules from VBA to a form your computer understands is called compilation; you say that you compile the module when you translate it When you run a procedure for the first time, Access compiles it for you automatically and opens a dialog box only when it finds syntax errors in the procedure New Perspectives on Microsoft Access

XP Adding a Second Procedure to a Class Module New Perspectives on Microsoft Access

XP Adding a Second Procedure to a Class Module New Perspectives on Microsoft Access

XP Changing the Case of a Field Value StrConv function wvProperCase constant vbUpperCase constant vbLowerCase constant New Perspectives on Microsoft Access

XP Hiding Controls and Changing a Control’s Color New Perspectives on Microsoft Access

XP Hiding Controls and Changing a Control’s Color New Perspectives on Microsoft Access

XP Helpful Hints None New Perspectives on Microsoft Access

XP Additional Examples None New Perspectives on Microsoft Access