Access VBA Programming for Beginners - Class 1 - by Patrick Lasu

Slides:



Advertisements
Similar presentations
Integrated Business Applications with Databases (D3) Jenny Pedler
Advertisements

Intro to Python Welcome to the Wonderful world of GIS programing!
AE6382 VBA - Excel l VBA is Visual Basic for Applications l The goal is to demonstrate how VBA can be used to leverage the power of Excel u VBA syntax.
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
VBA Modules, Functions, Variables, and Constants
CVEV 118/698 Visual Basic Lecture 1 Prof. Mounir Mabsout Expert 1: Elsa Sulukdjian Expert 2: Walid El Asmar.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Data Types and Operations Programming Fundamentals (Writing Code)Programming Fundamentals (Writing Code)
VB Code Statements 3 types of VB statement The Remark statement, known as comments, are used for project documentation only Begin with an apostrophe Not.
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
Adding Automated Functionality to Office Applications.
VBA & Excel Barry L. Nelson IEMS 465 Fall Quarter 2003.
VB DATATYPES, VARIABLES, CONSTANTS & CALCULATIONS.
Variables and Constants
Languages and Environments Higher Computing Unit 2 – Software Development.
Tutorial 11 Using and Writing Visual Basic for Applications Code
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Class 3 Programming in Visual Basic. Class Objectives Learn about input/output Learn about strings Learn about subroutines Learn about arrays Learn about.
Lab 01 Forms in excel Tahani ALdweesh Insert form into your project. 2. Change form’s properties. 3. Put controls on the form. 4. Change controls’
Problem Solving with the Sequential Logic Structure Lesson 5 McManusCOP10061.
Lecture 8 Visual Basic (2).
Outline Software and Programming Program Structure Tools for Designing Software Programming Languages Introduction to Visual Basic (VBA)
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Using Visual Basic for Applications in Microsoft Project Sean Vogel.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Applications Development
I Power Higher Computing Software Development Development Languages and Environments.
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
‘Tirgul’ # 2 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #2.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Three Memory Locations and Calculations.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Macro’s Within excel. Most functionality can be driven from VBA VBA is the programming language that runs inside of excel. It uses visual basic as the.
Programming with Microsoft Visual Basic th Edition
Variables Hold information that may be manipulated, used to manipulate other information or remembered for later use A storage location in memory (RAM)
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
Variables in VB.NET. Variables  A storage location in memory (RAM)  Holds data/information while the program is running  These storage locations can.
Higher Computing Software Development -So Far- 5/10/10.
Chapter 3 AS3 Programming. Introduction Algorithms + data structure =programs Why this formula relevant to application programs created in flash? The.
VCE IT Theory Slideshows By Mark Kelly vceit.com Version 2 – updated for 2016 Data Types 1 a.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
CIS 338: VB Variables Dr. Ralph D. Westfall April, 2011.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are used in programs so that values can be represented with.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Introduction to Computers
IE 8580 Module 4: DIY Monte Carlo Simulation
A variable is a name for a value stored in memory.
VBA - Excel VBA is Visual Basic for Applications
VBA - Excel VBA is Visual Basic for Applications
Access VBA Programming for Beginners - Class 3 -
Programming constructs
Microsoft Access Illustrated
Visual Basic 6 Programming.
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Visual Basic..
CIS16 Application Development Programming with Visual Basic
Visual Basic Numbers Chapter 3.3 Prepared By: Deborah 1/15/2019.
Chapter One: An Introduction to Programming and Visual Basic
CHAPTER FOUR VARIABLES AND CONSTANTS
Visual Basic Numbers Chapter 3.3 Prepared By: Deborah 7/9/2019.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Presentation transcript:

Access VBA Programming for Beginners - Class 1 - by Patrick Lasu

Class 1 - Overview What is VBA? What is VBA? History of VBA History of VBA Event-Driven Programming Event-Driven Programming Helpful Hints Helpful Hints Code Window Code Window Help in VBA Help in VBA Subs and Functions Subs and Functions Variables and Constants Variables and Constants

What is VBA? VBA = Visual Basic for Applications VBA = Visual Basic for Applications Visual Basic is a stand-alone programming software that is event-driven Visual Basic is a stand-alone programming software that is event-driven VB for Applications = Visual Basic that is “customized” to work with Access, Excel, Word, etc. VB for Applications = Visual Basic that is “customized” to work with Access, Excel, Word, etc. –Excel has Sheet objects –Word has Document objects –Access has Data objects

Brief History Visual Basic for Applications (VBA) is derived from Visual Basic (VB) Visual Basic for Applications (VBA) is derived from Visual Basic (VB) –VBA was fully integrated into Office –97 except Outlook –Prior to that, there were Macros Before VB, there was QBasic (Microsoft Products) Before VB, there was QBasic (Microsoft Products) –Based on BASIC (Beginners All-purpose Symbolic Instruction Code) programming language

Brief History Languages based on BASIC got a bad rap because: Languages based on BASIC got a bad rap because: –They were considered slow –Need a software platform to run

Brief History CPU Windows VB Software Platform for VB

Brief History CPU Windows Access VBA Software Platform for VBA

Event-Driven Programming What is it? What is it? –Code does not execute until an event is happening »Analogy: You answer the phone when it rings instead of picking up the receiver every 2 seconds to find out if somebody is calling. –Program is Form-centric »Code uses forms, which breaks up code into smaller portions, and gives the user flexibility when entering data.

Helpful Hints There are at least 3 ways of accomplishing the same task when coding There are at least 3 ways of accomplishing the same task when coding –Good Code = It works –Bad Code = It does not work Strive to make your code as short as possible Strive to make your code as short as possible –It saves time when typing code –Runs faster –Easier to debug Save Often (Ctrl + S) Save Often (Ctrl + S)

Variables and Constants A variable is a storage for a value that can change during code execution A variable is a storage for a value that can change during code execution –Answering Yes or No A constant is a storage for a value that does not change during code execution A constant is a storage for a value that does not change during code execution –3.1415, vbYes, vbRed –Can be changed manually »Going from 365 days to 360 days when calculating interest

Variables and Constants There are several Data Types for Variables and Constants for efficiency There are several Data Types for Variables and Constants for efficiency –String = Stores Text – “Patrick”, “123 Main St” –Number = Stores Numbers - “1, 2, 3,...”, “3.14” –Boolean = Stores True/False –Date = Stores Date –Currency = Currency format – “Dollar, Yen” –Variant = Stores Anything And there are many more!!!! And there are many more!!!!

Variables and Constants We will work mostly with (for starters): We will work mostly with (for starters): –Strings –Integers (whole numbers, no decimals) –Boolean –Variant

Variables and Constants Naming convention for Variables: Naming convention for Variables: –Strings – Starts with “str” »strFirstName –Integers – Starts with “int” »intCount –Boolean – Starts with “bln”, “bol”, “bool” »boolExit –Variant – Starts with “var” »varAnyValue

Variables and Constants A variable needs to be declared A variable needs to be declared Syntax: Dim variablename [As type] –Dim = Dimension (make space for it) –variablename = Ex: strFirstName –[As type] = Optional, Ex: As String Dim strFirstName As String

Variables and Constants Naming convention for Constants Naming convention for Constants –We’ll do it in next class!!!! –We’ll also talk about Public and Private variables and scope/visibility –Why not making all variables Variants –And much more…

Review It works!!! = Good Code It works!!! = Good Code –Code is short and sweet = Even better… There are at least 3 different ways of coding There are at least 3 different ways of coding Save Often Save Often Use the Help files Use the Help files