Article ID: 105511 - View products that this article applies to.
This article was previously published under Q105511
Moderate: Requires basic macro, coding, and interoperability skills.
This article demonstrates how to use the SysCmd() function to display custom messages in the Microsoft Access status bar.
NOTE: This article assumes that you are familiar with Access Basic and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information on Access Basic, please refer to the "Introduction to Programming" manual in Microsoft Access version 1.x, or the "Building Applications" manual, Chapter 3, "Introducing Access Basic" in version 2.0.
The SysCmd() function is documented in the manual "The Secrets of AccessWizards," which is included with the Microsoft Access Distribution Kit (ADK) version 1.1. You can use this function to change the text that appears in the status bar. For example, you might want to change the status bar to read "Sorting..." while a sort operation is taking place, and then remove it when the operation is complete.
The SysCmd() function syntax is as follows:
SysCmd(<action> [, <text>])
Replace <action> with a numeric expression identifying the action to take. Valid entries are as follows:
4 - Set the status bar text to the text argument 5 - Reset the status bar text
Replace <text> with a string expression that will appear left aligned in the status bar.
The SysCmd() function returns null, which is not used.
Setting Status Bar TextWhen the action argument is 4, the string expression in the text argument will appear in the status bar. For example, type the following expression in the Immediate window and the message "Sorting..." will appear in the status bar:
? SysCmd(4, "Sorting...")
Removing or Resetting the Status Bar TextWhen the action argument is 5, the status bar text set by the previous SysCmd() function is removed. For example, type the following in the Immediate window and the "Sorting..." message will be removed:
The text argument can contain about 80 characters. Since the text in the status bar uses a proportional font, the actual number of characters you can display is determined by the total width of all the characters in the text argument.
You cannot set the status bar text to an empty string. If you want to remove the existing text in the status bar, set the text argument to a single space.
How to Use SysCmd() in an Access Basic FunctionThe following sample function will place a message in the status bar, display a message box, and then remove the status bar text:
Microsoft Access Distribution Kit "The Secrets of AccessWizards," version 1.1, page 30
Article ID: 105511 - Last Review: May 6, 2003 - Revision: 2.0
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.