ACC: How to Change the Status Bar Text Using SysCmd()

Article translations Article translations
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.
Expand all | Collapse all

On This Page

SUMMARY

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.

MORE INFORMATION

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 Text

When 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 Text

When 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:
   ? SysCmd(5)
				

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 Function

The following sample function will place a message in the status bar, display a message box, and then remove the status bar text:
  1. Create a new module called Status Bar Test.
  2. Enter the following statement in the Declarations section:

    Option Explicit
  3. Enter the following function:
          Function StatusBar ()
             Dim RetVal As Variant
             RetVal = SysCmd(4, "The rain in Spain falls mainly ...")
             MsgBox "Press OK when you are ready to finish!"
             RetVal = SysCmd(5)
          End Function
    						
  4. To run the function, type the following in the Immediate window, and then press ENTER:

    ? StatusBar()

REFERENCES

Microsoft Access Distribution Kit "The Secrets of AccessWizards," version 1.1, page 30

Properties

Article ID: 105511 - Last Review: May 6, 2003 - Revision: 2.0
APPLIES TO
  • Microsoft Access 1.0 Standard Edition
  • Microsoft Access 1.1 Standard Edition
  • Microsoft Access 2.0 Standard Edition
Keywords: 
kbhowto kbprogramming KB105511
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.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com