Application.SysCmd (Access)

You can use the SysCmd method to display a progress meter or optional specified text in the status bar, return information about Microsoft Access and its associated files, or return the state of a specified database object (to indicate whether the object is open, is a new object, or has been changed but not saved).

For example, if you are building a custom wizard that creates a new form, you can use the SysCmd method to display a progress meter indicating the progress of your wizard as it constructs the form. By calling the SysCmd method with the various progress meter actions, you can display a progress meter in the status bar for an operation that has a known duration or number of steps, and update it to indicate the progress of the operation. To display a progress meter in the status bar, you must 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 the progress of the operation, call the SysCmd method with the acSysCmdUpdateMeter Action argument and the 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. You can also change the text that's displayed in the status bar by calling the SysCmd method with the acSysCmdSetStatus Action argument and the Text argument. For example, during a sort you might change the text to "Sorting...". When the sort is complete, you would reset the status bar by removing the text. The Text argument can contain approximately 80 characters. Because the status bar text is displayed by using a proportional font, the actual number of characters you can display is determined by the total width of all the characters specified by the Text argument. As you increase the width of the status bar text, you decrease the length of the meter. If the text is longer than the status bar and the Action argument is acSysCmdInitMeter, the SysCmd method ignores the text and doesn't display anything in the status bar. If the text is longer than the status bar and the Action argument is acSysCmdSetStatus, the SysCmd method truncates the text to fit the status bar. You can't set the status bar text to a zero-length string (" "). If you want to remove the existing text from the status bar, set the Text argument to a single space. The following examples illustrate ways to remove the text from the status bar:

SysCmd (Action, Argument2, Argument3)


varReturn = SysCmd(acSysCmdInitMeter, " ", 100) 
varReturn = SysCmd(acSysCmdSetStatus, " ")

Arguments

Action, Argument2, Argument3

The following argument is required

Action (AcSysCmdAction) - An 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, Access generates a run-time error.

Here you can find possible values for AcSysCmdAction

Argument2 (AcObjectType) - 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. NOTE: When you specify the acSysCmdGetObjectState value for the Action parameter, you must specify the appropriate AcObjectType constant.

Here you can find possible values for AcObjectType

Argument3 (AcSysCmdAction) - 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. NOTE: When you specify the acSysCmdGetObjectState value for the Action parameter, you must specify the name of the database object.

Here you can find possible values for AcSysCmdAction