Microsoft Access 2010 Bible

(Rick Simeone) #1

Part IV: Professional Database Development


918


TABLE 26.2

MsgBox Return Values


Button Pressed Constant Returned Value Returned
OK vbOK 1
Cancel vbCancel 2
Abort vbAbort 3
Retry vbRetry 4
Ignore vbIgnore 5
Yes vbYes 6
No vbNo 7

Creating and using a progress meter
Access provides a built-in progress meter in the status bar at the bottom of the main Access win-
dow. This progress meter is a green or blue rectangle that grows horizontally as a long-running
process is executed by Access.

Setting up and using a progress meter requires an initializing step, and then incrementing the
meter to its next value. As you increment, you don’t just increment a counter that is managed by
SysCmd. You must explicitly set the meter’s value to a value between 0 and the maximum you set
at initialization.

On the CD-ROM
The following code and demonstration is contained in a form named frmSysCmdDemo in the Chapter26.
accdb database.


Use the acSysCmdInitMeter constant to initialize the meter. You must pass some text that is
used to label the meter as well as the meter’s maximum value:

Private Sub cmdInitMeter_Click()
Dim vRetVal As Variant
MeterMax = 100
vRetVal = SysCmd(acSysCmdInitMeter, _
“Reading Data”, MeterMax)
End Sub

When this subroutine is run, the Access status bar appears, as shown in Figure 26.14.
Free download pdf