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:
[color blue] Dim [/color] varStatus [color blue] As Variant[/color]
You might also want to declare a String for any text you would like to display:
[color blue] Dim [/color] strStatus [color blue] As String[/color]
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:
The value [color red]21[/color] (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:
The value [color red]5[/color] 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.[color red][ul][li]Also remember to include the Status clear action in any error handling.[/li][li]And that, if you remove the Startup menu options, to keep the Display Status Bar checked. [/li][/ul][/color]
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).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.