Question How to disable button after click?

Lord Max

Registered User.
Local time
Today, 03:19
Joined
Sep 13, 2010
Messages
12
I have a button that runs a few statements for a purchases system, to avoid multiple or incorrect purchases, after it has been clicked once for one record, I would like it to be disabled. Then naturally it should be re-enabled on entering a new record.

Anybody know how to do this?

Thanks!

Max
 
When you Click on a Command Button normaly the focus remains on the Button and it will not allow you disable it. Write a statement in the On_Click eventprocedure to shift the focus to a different control like a text box and then disable the Button like the example below:

Code:
me.LastName.setfocus
me.cmdButton.enabled = false

You can enable the Command Button on a New Record with the following lines in the On_Current() Eventprocedure as follows:

Code:
If Me.NewRecord Then
   Me.cmdButton.Enabled = True
End If

Use your Command Button name in place of cmdButton.
 
Works like a charm, thanks.
 

Users who are viewing this thread

Back
Top Bottom