A ariansman Registered User. Local time Yesterday, 19:25 Joined Apr 3, 2012 Messages 157 Jul 6, 2013 #1 How can we design a button in a form, so that when it is pressed once, it will be inactivated until the form is open again? Or the button is inactivated for a certain time for example 10 seconds?
How can we design a button in a form, so that when it is pressed once, it will be inactivated until the form is open again? Or the button is inactivated for a certain time for example 10 seconds?
nanscombe Registered User. Local time Today, 03:25 Joined Nov 12, 2011 Messages 1,081 Jul 6, 2013 #2 The following code should allow you to disable the button until the form is closed and re-opened. You need to move the focus to be able to disable it. Code: Private Sub yourCommandButton_Click() Me.someOtherControl.Setfocus ' move focus somewhere else Me.yourCommandButton.Enabled = False End Sub
The following code should allow you to disable the button until the form is closed and re-opened. You need to move the focus to be able to disable it. Code: Private Sub yourCommandButton_Click() Me.someOtherControl.Setfocus ' move focus somewhere else Me.yourCommandButton.Enabled = False End Sub
A ariansman Registered User. Local time Yesterday, 19:25 Joined Apr 3, 2012 Messages 157 Jul 8, 2013 #3 thank you
Cronk Registered User. Local time Today, 12:25 Joined Jul 4, 2013 Messages 2,799 Jul 8, 2013 #4 The button can be re-enabled after a period of time by using the OnTimer event of the form. So part of the coding on the button click event is to set Me.TimerInterval =1000 * 60 * 10 'This is the number of milliseconds in 10 minutes And in the form's OnTimer event, put Me.buttonName.enabled = true Me.TimerInterval =0 'to turn off the OnTimer event
The button can be re-enabled after a period of time by using the OnTimer event of the form. So part of the coding on the button click event is to set Me.TimerInterval =1000 * 60 * 10 'This is the number of milliseconds in 10 minutes And in the form's OnTimer event, put Me.buttonName.enabled = true Me.TimerInterval =0 'to turn off the OnTimer event