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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time to display command button 1

Status
Not open for further replies.

techkenny1

Technical User
Jan 23, 2009
182
AU
Hi
Is it possible to put a timer on a command button so say after 6 seconds the command button becomes in operative.

Thanks
 
Code:
Option Compare Database
Dim scnd As Integer


Private Sub Form_Load()
    Me.TimerInterval = 1000
    scnd = 6000
    Me.Command1.Caption = "Wait " & 6
End Sub

Private Sub Form_Timer()
    If scnd = 1000 Then
        Me.Command1.Enabled = True
        Me.Command1.Caption = "Click Me"
        Me.TimerInterval = 0
    Else
        scnd = scnd - 1000
        Me.Command1.Caption = "Wait " & scnd / 1000
    End If
End Sub

Zameer Abdulla
 
Hi ZmrAdbullah,
Many thanks for your reply. It works great as is, but is it possible to do this in reverse.
I have this command button that is enabled by a check box. I want then after th4e command button has been pressed for the timer to disable this button.

Many thanks
 
Hi ZmrAbdullah,

Thanks for your reply.

I have done this and it works to a point.
When the command button is activated to open a form I get this error:"you can't disable a control while it has focus"
Do you have any answers to this

Many thanks
 
set focus to another control before you disable the button.


Zameer Abdulla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top