Using the StatusBar Control
You can use the StatusBar control to quickly and easily add professional-looking status bars to your forms, as shown at the bottom of the frmCalendar form in Figure 21.11. The StatusBar in the figure has six panels; the first two have been configured to display the current date and time, and the last three display the status of the Caps, Num, and Ins keys.You can set properties for the StatusBar control as a whole or for the individual panels (see Figure 21.13). The Style property specifies whether you want the status bar to include multiple panels or only a single panel. The SimpleText property is used only for single-panel status bars; it specifies the text in the panel. Finally, the MousePointer property lets you select the type of mouse pointer that appears when it's placed over the StatusBar control.
Figure 21.13. The general properties of the StatusBar control.

Each panel of the StatusBar control has properties that affect what that panel looks like and how it performs. The Index property of the panel is used to identify the particular panel. The panel properties are shown in Figure 21.14. The Style property is an important one; it specifies what information is displayed in the panel. It can be set to Text, Caps, Num Lock, Ins, Scroll, Time, Date, or Kana Lock (used for the Japanese character set). When set, the control can automatically sense whether the Caps Lock or other keys are active. The Text property indicates the text displayed in the panel when the Style property is set to Text. The value of this property is often modified at runtime to display a specific message to the user. The Alignment property determines whether the information is left-aligned, right-aligned, or centered in the panel, and the Bevel property can be set to None, Inset, or Raised.
Figure 21.14. The StatusBar panel properties.

As you insert and remove panels, each panel is assigned an index, and the Index property is used to refer to a specific panel at runtime, as shown in this example:Private Sub calPickADay_AfterUpdate()
'If the selected date equals today's
'date, include the text TODAY!!! in the
'third panel of the status bar
If calPickADay.Value = Date Then
sbrStatus.Panels(3).Text = "TODAY!!!"
'Otherwise display nothing in the third panel
'of the status bar
Else
sbrStatus.Panels(3).Text = "
End If
End Sub
This code evaluates the calPickADay value to see whether it's equal to the current date. If so, the text of the third panel is set to TODAY!!!. Otherwise, the third panel's text is set to a zero-length string.CAUTIONIn the Access world, almost everything is zero-based. Of course, there are exceptions to every rule. The StatusBar control is one of those exceptionsit's one-based. The code in the previous example really does modify the text in the third panel.