Microsoft

Grab user attention with blinking text in an Access form

A virus scan I use blows what sounds like a foghorn when it's done. I try to be out of the room because it's so loud and annoying. I prefer a gentler approach. Blinking signs are a good attention-getter, without being harsh. There are two ways to blink a control or text: on and off or by switching colors. Of course, blinking text won't replace a sound cue, but done well, it's easy on the eyes and nerves.To blink on and off, use a Timer event in the following form:

Private Sub Form_Timer()

Me!control.Visible = Not Me!control.Visible

End Sub

Each time the form executes its timer event, this code toggles the control's Visible property. You can use this simple technique to blink just about any control, but the control can't have focus at the time.

Switching between two colors is just as easy:

Private Sub Form_Timer()

With Me!control

.ForeColor = IIf(.ForeColor) = color1, color2, color1)

End With

End Sub

The form's timer event alternates between color1 and color2. Use integer values or constants for colors. For instance, use 0 or vbBlack for black, and 255 or vbRed for red. This probably works best with a label or command button, but you could use it with any control that has a Fore Color property.

Blinking text doesn't necessary mean the user has to do anything, but it can. How the user reacts to the text is really up to you. In both of these simple events, the blinking is continuous; it won't stop when the user takes some action.

If the control or text fails to blink, check the form's Timer Interval property. A setting of 500 creates a reasonable blink. A setting of 50 is so fast that it creates a neon effect. This works only with forms, as reports don't have a Timer event.

Private Sub Form_Timer()

Me!control.Visible = Not Me.control.visible

End Sub

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks

Free Newsletters, In your Inbox