One time button click

SBCUser666

Registered User.
Local time
Today, 02:51
Joined
Jul 7, 2009
Messages
21
I have a form with 1 button. User clicks button and a bunch of stuff is done. No other forms or buttons are involved.

I want the button to be able to be clicked only once during this execution of Access.

I can't disable the button in my OnClick event code because it has control.
 
I have a form with 1 button. User clicks button and a bunch of stuff is done. No other forms or buttons are involved.

I want the button to be able to be clicked only once during this execution of Access.

I can't disable the button in my OnClick event code because it has control.
You can put a static variable in your click event to only run it once until the database is closed and reopened.

Code:
Static blnRunOnce As Boolean
 
If blnRunOnce = False Then
   blnRunOnce = True
   ...Do your other stuff here
End If
 
I saw that solution somewhere else but was concerned what the initial value of a boolean was. I assume this solution means the initial value is False.

Thanks!
 
I saw that solution somewhere else but was concerned what the initial value of a boolean was. I assume this solution means the initial value is False.

Thanks!
Yep, the initial value of a boolean is false, the initial value of a string variable is "" (an empty string), an initial date variable is null, and an initial numeric is 0.
 

Users who are viewing this thread

Back
Top Bottom