| Feedback | Various bits of code |

Controlling the Access status bar

While your visual basic procedures are running it is helpful to give users some information about what is happening during any apparent pauses caused by data processing. Messages can be displayed in the gray bar at the bottom of the Access program window, controlled by a VBA procedure. This program (called StatusBar) simply applies the appropriate code in a more memorable and recognisable format.

A selection of books about Access from Amazon

It can then be used in other procedures as shown in the three following examples:

StatusBar "Uploading payroll file ..." StatusBar "" StatusBar

The second and third examples both clear the message and return control to normal Access system messages.

Place the following visual basic code in a Module:

Sub StatusBar(Optional Msg As Variant)
Dim Temp As Variant

' if the Msg variable is omitted or is empty, return the control of the status bar to Access

If Not IsMissing(Msg) Then
 If Msg <> "" Then
  Temp = SysCmd(acSysCmdSetStatus, Msg)
 Else
  Temp = SysCmd(acSysCmdClearStatus)
 End If
Else
  Temp = SysCmd(acSysCmdClearStatus)
End If
End Sub


file: astatus.htm © MeadInKent.co.uk 2014 Page last updated Sep14