Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make a command button Flash

Status
Not open for further replies.

yankinsf

Technical User
Sep 25, 2003
15
US
How do I make a command button flash on the main form when a new record is added to a subform?I have already written the code behind this button,just need to add code to make the button flash.
Thanks for your tips.

Sam
 
One way to do it is to place a timer on your form and, when the new record is added, enable the timer. In the timer event, do something like

Sub tmrFlash()
With CmdButton
.BackColor = IIF ( .BackColor = vbButtonFace, vbCyan, vbButtonFace)
End With
End Sub

and when the button is clicked

Sub cmdButton_Click()
tmrFlash.Enabled = False
cmdButton.BackColor = vbButtonFace
...

Be sure that the cmdButton.Style property is set to 1 (i.e. Graphical). Adjust the timer interval to control how fast the button flashes.
 
to make the button flash enter this code in the On Timer event of your form:

'replace nameofcommandbutton with your command button's name.

If nameofcommandbutton.visible = True Then
nameofcommandbutton.visible = False
Else
If nameofcommandbutton.visible = False Then
nameofcommandbutton.visible = True
End If
End If

make sure the timer interval is defaulted to 0.

in the event proc that creates the new record you will need to set the timer interval:

me.TimerInterval = 250

hope this helps you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top