Progress meter

Display a progress meter or optional specified text in the MS Access status bar.

Syntax
      expression .SysCmd(Action [, Argument2, Argument3] )

Key
    Action    A AcSysCmdAction constant that identifies the type of action to take.
              This set of constants applies to a progress meter.
              The SysCmd method returns a null if these actions are successful.
              Otherwise, Microsoft Access generates a run-time error.

   Argument2  The text to be displayed left-aligned in the status bar.
              This argument is required when the action argument is acSysCmdInitMeter,
              acSysCmdUpdateMeter, or acSysCmdSetStatus;
              this argument isn't valid for other action argument values.

   Argument3  A numeric expression that controls the display of the progress meter.
              This argument is required when the action argument is acSysCmdInitMeter;
              this argument isn't valid for other action argument values.

You can display a progress meter in the status bar for any operation that has a known duration or number of steps, and update it to indicate the progress of the operation. Typically a loop with a known number of iterations or a Form Wizard with a known number of Steps.

To display a status bar progress meter, first call the SysCmd method with the acSysCmdInitMeter action argument, and the text and value arguments. When the action argument is acSysCmdInitMeter, the value argument is the maximum value of the meter, or 100 percent.

To update the meter (to show new progress), call SysCmd with the acSysCmdUpdateMeter action argument and an appropriate value argument.

When the action argument is acSysCmdUpdateMeter, the SysCmd method uses the value argument to calculate the percentage displayed by the meter. For example, if you set the maximum value to 200 and then update the meter with a value of 100, the progress meter will be half-filled.

To change the text displayed in the status bar, call SysCmd with the acSysCmdSetStatus action argument and the new text argument.
For example, during a sort you might change the text to "Sorting...".

The status bar text is displayed using a proportional font, so the number of characters that will fit may vary - keep the messages short.

To remove any existing text from the status bar, set the text argument to a single space " " (n.b. not a zero length string).

Example

' Initialise meter
varReturn = SysCmd(acSysCmdInitMeter, " ", 100)  
' Set to halfway
varReturn = SysCmd(acSysCmdSetStatus, "Thinking...", 50)

'wait for 3 seconds
Dim WAIT As Double
WAIT = Timer
While Timer < WAIT + 3
    DoEvents  
Wend 
' Clear message
varReturn = SysCmd(acSysCmdSetStatus, " ")

“The greatness of a nation and its moral progress can be judged by the way its animals are treated” ~ Mahatma Gandhi


Copyright © SS64.com 1999-2017
Some rights reserved