CIST 304. Week 7: Chapters 15 & 16 VB with other applications and MS Access

Similar documents
END-TERM EXAMINATION

What's New in Access 2000 p. 1 A Brief Access History p. 2 Access the Best Access Ever p. 5 Microsoft Office Developer Features p.

KEYWORDS DDE GETOBJECT PATHNAME CLASS VB EDITOR WITHEVENTS HMI 1.0 TYPE LIBRARY HMI.TAG

Script Host 2.0 Developer's Guide

The name of this type library is LabelManager2 with the TK Labeling Interface reference.

Part I: Programming Access Applications. Chapter 1: Overview of Programming for Access. Chapter 2: Extending Applications Using the Windows API

Interacting with External Applications

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

User-defined Functions. Conditional Expressions in Scheme

Acknowledgments Introduction. Part I: Programming Access Applications 1. Chapter 1: Overview of Programming for Access 3

Argumentative Development Notes

Sub Programs. To Solve a Problem, First Make It Simpler

In this chapter, I m going to show you how to create a working

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation

Microsoft Excel 2013 Unit 1: Spreadsheet Basics & Navigation Student Packet

Ms Dos Commands List With Examples Ppt


9. Introduction to MS Access

AD07 A Tool to Automate TFL Bundling

catman ActiveX interface Jens Boersch

Acknowledgments Introduction. Chapter 1: Introduction to Access 2007 VBA 1. The Visual Basic Editor 18. Testing Phase 24

An Introduction to Windows Script Components

Visual Basic 6 (VB6 Comprehensive) Course Overview

Lab 7 Macros, Modules, Data Access Pages and Internet Summary Macros: How to Create and Run Modules vs. Macros 1. Jumping to Internet

Programming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11

APCS Semester #1 Final Exam Practice Problems

Prentice Hall CBT Systems X In A Box IT Courses

CERTIFICATE IN WEB PROGRAMMING

Styles and Conditional Features. Version: 7.3

LUSAS Programmable Interface (LPI) Customisation and Automation Guide. LUSAS Version 15.2 : Issue 1

Basic Programming Language Syntax

Copyright. Trademarks Attachmate Corporation. All rights reserved. USA Patents Pending. WRQ ReflectionVisual Basic User Guide

INDEX. Note: boldface numbers indicate illustrations; italic t indicates a table. 345

How to Access Your Student and Use Other Features from Google. Fall 2017 Michelle Lowe

IMIR Reporting Services

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

COURSE CONTENT Excel with VBA Training

Tech-Talk Using the PATROL Agent COM Server August 1999 Authored By: Eric Anderson

Styles and Conditional Features

SelectSurveyASP Advanced User Manual

Google Docs. University Of Furtwangen, E-Business Technology. Prof. Dr. Eduard Heindl. By: Xia Cuihua

A Back-End Link Checker for Your Access Database

Scheme: Expressions & Procedures

A A B U n i v e r s i t y

Limnor Studio Getting Started

Pre Lab (Lab-1) Scrutinize Different Computer Components

Highlighting Intrinsyc s Technologies: Intrinsyc J-Integra Bi-Directional Pure Java-COM Bridge

Visual Basic Primer A. A. Cousins

8. Control statements

Computer Science II Lecture 1 Introduction and Background

To reduce confusion over the word application, the following table defines the terms used in this technical article.

Taking Advantage of ADSI

Overloading Functions & Command Line Use in C++ CS 16: Solving Problems with Computers I Lecture #6

4 Working with WSH objects

QUIZ. How could we disable the automatic creation of copyconstructors

Pace University. Fundamental Concepts of CS121 1

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Bruce Moore Fall 99 Internship September 23, 1999 Supervised by Dr. John P.

SAP Automation (BC-FES-AIT)

Level 3 Computing Year 2 Lecturer: Phil Smith

UEE1302 (1102) F10: Introduction to Computers and Programming

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.

QUIZ. How could we disable the automatic creation of copyconstructors

A Small Interpreted Language

Computer Science 21b (Spring Term, 2015) Structure and Interpretation of Computer Programs. Lexical addressing

Workshare Professional 10. Getting Started Guide

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

JAVA An overview for C++ programmers

CS 320: Concepts of Programming Languages

Shell Start-up and Configuration Files

Center for Faculty Development and Support. Google Docs Tutorial

Password Protect an Access Database

CIS192: Python Programming

CS637 Midterm Review

I Didn't Know DB2 Did THAT! V9 & V10 Update CENTRAL CANADA DB2 USER GROUP

Plan (next 4 weeks) 1. Fast forward. 2. Rewind. 3. Slow motion. Rapid introduction to what s in OCaml. Go over the pieces individually

Getting started 7. Setting properties 23

EL2310 Scientific Programming

Getting started 7. Setting properties 23

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson

INF 102 CONCEPTS OF PROG. LANGS FUNCTIONAL COMPOSITION. Instructors: James Jones Copyright Instructors.

Millennium Report Writer

Manual Vba Access 2007 Recordset Find

Manual Vba Access 2010 Recordset Find

Access VBA LinkedIn Introduces object oriented programming and provides a foundation in the Access object model and the Visual Basic for Applications

Visual Basic 6 includes many tools to help you create, revise, manage, and

Appendix C WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

The DCOM Connector HELP.BCMIDDCOM. Release 4.6C

Introduction to Programming

Introduction to MySQL. Database Systems

EXERCISE: Introduction to client side JavaScript

Once you have entered your Google and password, you can click the Sign In button to continue.

QUETZALANDIA.COM. 5. Data Manipulation Language

DR B.R.AMBEDKAR UNIVERSITY B.Sc.(Computer Science): III Year THEORY PAPER IV (Elective 4) PHP, MySQL and Apache

Lab # 6. Using Subqueries and Set Operators. Eng. Alaa O Shama

Validate and Protect Data

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

: CREATING WEB BASED APPLICATIONS FOR INSTRUMENT DATA TRANSFER USING VISUAL STUDIO.NET

BAAN IV OLE with BAAN IV

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 14 Database Connectivity and Web Technologies

Transcription:

CIST 304 Week 7: Chapters 15 & 16 VB with other applications and MS Access

Visual Basic Interoperability VB can be used across applications VB interoperability with other MS Office applications (Word, Access, PowerPoint, etc) VB interoperability with third party applications VB can launch applications exchange data between applications modify the file system reach out across the network (including the Internet) Ch 15

Launching Applications Shell Allows you to start an application using VB Ex: Shell calc.exe, vbmaximizedfocus Complete path needed (unless the file s directory location is already in the $PATH variable Note the Windows styles in Table 15.1 (hidden, max, etc) What applications can we launch? Calculator Notepad Control Panel pretty much any Ch 15

Try This: Hands-on 15.1 Complete the Hands-On 15.1 exercise Try changing the cpl files Which cpl file gets us directly to the window that lets us change the user display? Do an Internet search for dll or cpl files that are not listed in Table 15.2 and try using those in the shell command. Ch 15

Moving Between Applications AppActivate Changes the focus (i.e. allows you to move between applications that are already open) Table 15.3 shows MS Office app constants The [wait] argument is optional. If [wait] is set to False, there is no delay. Note: the title is enclosed in quotes and must exactly match the name of the running application Ch 15

Controlling Another Application AppActivate works if the other application is already running SendKeys Sends keystrokes to an open application Syntax: SendKeys string [,wait] string is the set of keystrokes you want to send to the open application [wait] is optional (similar to AppActivate option) Table 15.4 lists some of the keycodes Reserved characters must be enclosed in braces {} Ch 15

Controlling Applications - Automation Automation provides functionality to access the object model of other applications Concept is similar to accessing the object model in Excel Access the properties and methods of the application s objects Automation replaces Dynamic Data Exchange (DDE). Ch 15

Automation / Object Linking and Embedding (OLE) OLE allows you to create compound documents (p420) Compound documents are composed of objects from different applications Word document with Excel table PowerPoint document with Excel table Word document with PowerPoint slide etc Linked vs. Embedding When a linked object is changed the object as it is contained in other objects will change Embedding simply inserts the object without creating a linking (i.e. if the original changes, the embedded object will not) Ch 15

Component Object Model (COM) Provides Automation interfaces Includes all the object properties and methods VB can directly access the object s interfaces using COM Ch 15

Binding Binding is the process by which VB associates the code with the object Late vs. Early binding Late: aka runtime binding VB waits until the procedure is executed before it associates with the object Pros: Can be used with all Automation objects Cons: Programmer must manually define the association Early: aka compile-time binding VB makes the association when the program is compiled Ch 15

References Tools->References allow us to add object references (part of establishing the early binding) Object Browser will reflect the addition of the added reference Ch 15

Creating Automation Objects CreateObject Function GetObject Function Ch 15

Excel, VB, and MS Access (oh, boy ) Concepts from previous section are still applicable MS Access application interoperability and object access is nuanced because you are accessing a database. Special methods for accessing a database: Automation (as before) Data Access Objects (DAO) ActiveX Data Objects (ADO) Ch 16

What is a database? A set of tables with defined relationships Each table is similar to an Excel spreadsheet Rows = records Columns = fields Each record needs a primary key (a unique identifier for that record) Tables can be linked through common fields (relationship) EmpID Name Dept Hired 12345 Jones 11 9/1/2000 67891 Jones 42 3/6/2012 EmpID Salary 12345 $22,000 67891 $31,000 Dept Manager 11 Smith 42 Willis Ch 16

MS Access Object Library Like everything else MS Access uses objects Objects are contained in the MS Access library msacc.olb file Database objects provide ways to connect to the database provide ways to manipulate the database structure provide ways to add, update, modify, delete database entries Need to setup a reference to the Access Library Ch 16

Establishing a connection to the database from Excel Database not secured (no password) you can use Automation (see book) Database secured with a password DAO method Setup a reference Define the connection string Use object methods to connect ADO method Setup a reference Define the connection string Use object methods to connect Ch 16

Creating a new Access database using DAO Functions CreateDatabase: creates the database CreateTableDef: creates a table within the database CreateField: creates a field within the table Methods Append: appends fields and tables to the object Close: closes the database Ch 16

Hands-On 16.5 Code Breakdown: Declaring Objects Dim db as DAO.Database Dim tbl as DAO.TableDef Dim strdb as String Dim strtbl as String DAO TableDef strdb tbl Database sttbl db Ch 16

Hands-On 16.5 Code Breakdown: Building Table strtbl = tblstates Set db = CreateDatabase(strDb, dblanggeneral) Set tbl = db.createtabledef(strtbl) With tbl.fields.append.createfield( StateID, dbtext, 2).Fields.Append.CreateField( StateName, dbtext, 25).Fields.Append.CreateField( StateCapital, dbtext, 25) End With tblstates StateId StateName StateCapital Ch 16

Hands-On 16.5 Code Breakdown: Appending Tables to DB db.tabledefs.append tbl db tbl StateId StateName StateCapital Ch 16

Creating a Database - Try This Use Visual Basic to create a database called UMW Students Create the table structure (definition) below and append it to the database StudentId LastName Major Year Ch 16

In-Class Assignments Hands-On 16.11 Ch 16