| 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.

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:

Would you like to learn more?

click link to find out about this book

Access 2003 Professional Results

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)
  Temp = SysCmd(acSysCmdClearStatus)
 End If
  Temp = SysCmd(acSysCmdClearStatus)
End If
End Sub

file: astatus.htm MeadInKent.co.uk 2004 Page last updated Sep06