0% found this document useful (0 votes)
18 views2 pages

4th Meeting FINALSFundamental of Database Systems

Lecturer for data base

Uploaded by

suhojessica0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

4th Meeting FINALSFundamental of Database Systems

Lecturer for data base

Uploaded by

suhojessica0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

INFORMATION SHEET NUMBER 14

Using Microsoft Visual Basic in Database

If you want to fully customize your database, or if you need to create a custom function not
possible through an expression or predefined macros, you might need to use programming codes.
Programming in Access is done using the Microsoft Visual Basic for Applications (VBA) code.

Microsoft Visual Basic (VB)

- is a programming language used to create Windows-based applications. It is based on the


old BASIC (Beginner’s All-Purpose Symbolic Instruction Code) language
- Visual Basic for Access is used to create procedures that dynamically manipulate objects.
For example, you can write a procedure that add, subtract, multiply or divide numbers
entered by the user or changes the color of a field on a form when the user performs a
particular action
- We write our programs in Visual Basic Editor. It is an environment in which you can edit
macros that you’ve recorded and write new macros and VB procedures

MsgBox Function

You can use Visual Basic procedures to customize your message box that is not possible
through macros. MsgBox function displays a message in a dialog box, waits for the user to click a
button, and returns an Integer indicating which button the user clicked.

Part Description

Prompt String expression displayed as the message in the message box.


Buttons This part is optional. This returns numeric expression that is the sum of values
specifying the number and type of buttons to display the icon style to use, and the
default button.
Title This part is optional. The text that appears in the title bar of your message box. If you
omit title, the application name is placed in the title bar.
Helpfile This part is optional. String expression that identifies the helpfile to use to provide
context sensitive Help for the dialog box. This provides help for the user of your
database. If you provide helpfile, context for the helpfile must also be provided.
Context This part is optional. Numeric expression that is the Help context number assigned to
the appropriate Help topic by the author of the Helpfile.

Types of button

Constant Button type Value Meaning


vbOKOnly 0 Display OK button only.
vbOKCancel 1 Display Ok and Cancel buttons.
vbAbortRetryIgnore 2 Display Abort, Retry, and Ignore buttons.
vbYesNoCancel 3 Display Yes, No, and Cancel buttons.
vbYesNo 4 Display Yes and No buttons.
vbRetryCancel 5 Display Retry and Cancel buttons.
vbHelp 16384 Display Help button only.
Icon Styles
Constant Icon Value Meaning
vbCritical 16 Displays Critical Message icon.
vbQuestion 32 Displays Warning Query icon.
vbExclamation 48 Displays Warning Message icon.
vbInformation 64 Displays Information Message icon.

Default
Constant Default value Meaning
vbDefaultButton1 0 First button is the default.
vbDefaultButton2 256 Second button is the default.
vbDefaultButton3 512 Third button is the default.
vbDefaultButton4 768 Fourth button is the default

Sample Program:
MsgBox “This is just a demo. Do you want to continue?”, 67, “Sample” where the result of
adding the values for button types, icon styles and default: 64 + 3 + 0

Title

Displays
Information icon Prompt
(64)

First button is default


(0)

Displays Yes, No
and Cancel buttons
(3)

You might also like