Databases Reference
In-Depth Information
vbDefaultButton2
256
Second button is default
v
bDefaultButton3
512
T
hird button is default
vbDefaultButton4
768
Fourth button is default
Modality
v
bApplicationModal
0
A
pplication modal message box
vbSystemModal
4096
System modal message box
For instance, the code:
MsgBox "Proceed?", vbQuestion + vbYesNo
displays the message box shown in Figure 12-1, which includes a question-mark icon and
two command buttons, labeled
Yes
and
No
.
Figure 12-1. A MsgBox dialog box
The
title
parameter is a string expression that is displayed in the title bar of the dialog
box. If we omit this argument, then
Microsoft Access
will be displayed, as in Figure 12-1.
The
MsgBox
function returns a number indicating which button was selected. These
return values are given in Table 12-4. (They are officially defined in the
VbMsgBoxResult
enum.)
Table 12-4
.
MsgBox return values
Constant
Value
Description
v
bOK
1
O
K button pressed
vbCancel
2
Cancel button pressed
v
bAbort
3
A
bort button pressed
vbRetry
4
Retry button pressed
v
bIgnore
5
I
gnore button pressed
vbYes
6
Yes button pressed
v
bNo
7
N
o button pressed
12.2 The InputBox Function
The
InputBox
function is designed to get input from the user. The most commonly used
(but not complete) syntax is:
InputBox(
prompt
[,
title
] [,
default
])