• Tidak ada hasil yang ditemukan

Access-8.ppt 525KB Mar 29 2010 04:55:16 AM

N/A
N/A
Protected

Academic year: 2017

Membagikan "Access-8.ppt 525KB Mar 29 2010 04:55:16 AM"

Copied!
20
0
0

Teks penuh

(1)

Exploring Microsoft Access

Chapter 8

Creating More Powerful

Applications:

(2)

Objectives

(1 of 2)

• Describe relationship of VBA to Microsoft Office • Describe components of the Module window

• Describe two ways to create an event procedure • Explain how the Quick Info and Complete Word

features simplify entry of VBA statements

(3)

Objectives

(2 of 2)

• Describe MsgBox parameters

• Create an event procedure to facilitate data entry through keyboard shortcuts

• Create an event procedure that substitutes an application-specific message for the standard Access error messages

(4)

Overview

• VBA is a programming language to build

truly useful Access applications

• VBA is event driven: Procedures respond to

specific events

• VBA can modify procedures that Access

has already created

(5)

Introduction to VBA

• Data validation

• Facilitate data entry, including creating

keyboard shortcuts

• Error trapping

(6)

Modules and Procedures

• Visual Basic code is developed in units called

procedures

• Event procedures: run automatically in

response to an event

(7)

Modules

• All procedures are stored in modules; one module contains one or more procedures

• Every form in Access has its own module (Class module), which contains procedures for that form • Private procedure: accessible only from within the

module in which it is contained

• Public procedure: accessible from anywhere

(8)

Module Window

Name of procedure (Form_Close)

MsgBox statement

Name of next Procedure

(9)

MsgBox Statement

• MsgBox takes three arguments (known as

parameters)

• Prompt: Specifies the message text

• Buttons: Type of command buttons and icon

• Title: Text that appears in title bar of the

(10)

Create an Event Procedure

Select Event tab

Click On Current Select Code Builder Right click on

(11)

On Current Event Procedure

Procedure header

Name of Combo Box from step 3

(12)

Facilitating Data Entry

• Use the Default property to specify default

values for certain fields

• Use VBA to create keyboard shortcuts

(13)

KeyDown Event Procedure

Select Form in the Object list box

Select KeyDown

from the Procedure List box Key words

(14)

ShortCut Command Button

Select the command button Properties All tab

Change Name to ShortCutButton

Change Caption to &ShortCuts

(15)

Error Trapping

• Produce more user-friendly error message • Find the error number using the Immediate

window

• Use case statements to test the value of an

incoming variable and produce the appropriate statement

• Once error is detected, Call MsgBox statement to display your user-friendly error message

(16)

Error Event Procedure

Case 1 Error numbers

Case 2

(17)

Data Validation

• Invalid data corrupts validity of information

• Data validation is therefore crucial

• Use VBA to extend data validation

capabilities within Access

(18)

MsgBox Function vs. Statement

MsgBox function

: displays a prompt to

the user, then returns a value

- Requires parentheses around arguments

(19)

Chapter 8 Summary

(1 of 2)

• VBA is a subset of Visual Basic

• VBA is accessible by all Microsoft Office applications

• All VBA procedures are stored in modules

(20)

Chapter 8 Summary

(2 of 2)

• All procedures are either public or private:

Private—accessible only from within its module public—accessible from anywhere

• Event procedures were created to illustrate how VBA is used to improve an application

• MsgBox function has three arguments:

Referensi

Dokumen terkait

Perusahaan telah menerapkan prinsip akuntabilitas, namun terdapat bebrapa bagian yang ti- dak diterapkan secara maksimal, sebagai berikut: auditing tidak dilakukan oleh

Dengan ini diberitahukan bahwa setelah dilakukan evaluasi dan penghitungan oleh Panitia Pengadaan Jasa Konsultansi Pengawasan Pengadilan Negeri Banjarmasin sesuai

Hasil penelitian ini sama dengan penelitian yang dilakukan sebelumnya oleh Auzi Annisa dan Pantius Drahen Soeling (2013) serta Maha Ahmed Zaki Dajani (2015) yang

Pokja IV ULP Pekerjaan Revitalisasi Pasar Teluk Dalam Muara di lingkungan Dinas Pengelolaan Pasar Kota Banjarmasin akan melaksanakan Pelelangan Umum dengan pascakualifikasi untuk

Panitia Lelang Pelaksanaan Normalisasi Saluran Sungai Besar pada Dinas Sumber Daya Air dan Drainase Kota Banjarmasin akan melelangkan paket pekerjaan konstruksi dengan

Proses transisi manajemen dan kepemilikan pada perusahaan dilihat melalui dua sisi yaitu dari sisi kesiapan calon suksesor dan dari sisi relasi dalam keluarga yang

[r]

kalau kita menganggap itu beban ya kita gak akan lepas dari itu, akan kepikiran terus, tapi kita harus berpikir sebaliknya, dari masalah ini kita bisa