INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Access 101

How to use the Status bar to your advantage. by RemyS
Posted: 30 Apr 02

This will come in handy, particularly when building a database which will be used by others.

The Status bar is the bar at the bottom of the screen, which usually says "Ready", or shows you the progress of a query.  However it doesn't always tell you what Access is doing, or at what stage of a Subroutine it is at.

You can use it as a simple, more informative means of let users know what is going on.

First you will need to declare a Variant:

Dim varStatus As Variant

You might also want to declare a String for any text you would like to display:

Dim strStatus As String


You then use this variant to assign any message to the Status bar with the acSysCmdSetStatus  action of the SysCmd function, like so:

strStatus = "The database is searching for the most recent file..."
varStatus = SysCmd(acSysCmdSetStatus, strStatus)


You can also display a progress meter with the acSysCmdInitMeter action, like so:

strStatus = "Importing four XLS files"
varStatus = SysCmd(acSysCmdInitMeter, strStatus, 21)

The value 21 (identified as [Argument3]) determines the 100% value
(There are 20 blocks in the progress meter, but the meter starts with one already filled in, so 21 is an easy value to use, unless you want to use 100 and true percentages values.)


The meter is updated whenever the acSysCmdUpdateMeter action is used, like so:

varStatus = SysCmd(acSysCmdUpdateMeter, 5)

The value 5 represents the amount of the progress meter to fill in.  So here, 5 will fill in 5 blocks, 25% of the progress meter.


Once you have filled in the progress meter (or at any stage) you can either display another text statement, or another progress meter, but if you have finished you must remember to clear the Status bar with the acSysCmdClearStatus action, like so:

varStatus = SysCmd(acSysCmdClearStatus)


Note: you can only update the meter whilst the same procedure is running from which it was initiated.  The update can be run from nested subroutines, but if the procedure is halted or ends, a new varStatus must be assigned.
  • Also remember to include the Status clear action in any error handling.
  • And that, if you remove the Startup menu options, to keep the Display Status Bar checked.



*********************************************************

The SysCmd function will also display system information about the database.

One which is particularly useful, if you design n-tier secured applications is:
Current_Workgroup = SysCmd(acSysCmdGetWorkgroupFile)
which can be used to determine if a user has opened the right Access shortcut to have access to secured features (i.e. "C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" /wrkgrp C:\Winnt\system32\SECURE1.MDW).

**********************************************************

Back to Microsoft: Access Other topics FAQ Index
Back to Microsoft: Access Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close