Command Button.Enabled = False

wop0703

Registered User.
Local time
Today, 17:58
Joined
Jun 1, 2005
Messages
77
I have a form with many command buttons. This form is a master for a database that keeps time for my department. One command button is a setup button that I want the user to run once and only once. What code, and where do I put it will allow my to set the command button's visible or enabled to be false. Even when the user closed the database and reopend it, if the user has run the setup once, I do not want to allow them to run it again.

Thanks.
 
How often does the user run the setup? Once a day / week? or just once and never again?

Col
 
Once and never again.
 
Just thinking quickly - you could have a table and post the users LoginName to the table and search the table on open of the form to see if the LoginName matches. If it does then make the button disabled if not then make it enabled.

Use the Environ("UserName") to pick up the UserName is best.

Col
 
I like the idea, but what is the code for searching the table. I am new at the whole Access code thing.
 
I have created a small database showing a way you can implement this feature without tracking the user. Note that when the form loads it checks to see if the value in the field of the table is set to true, if it is the button is hidden and the value of the text box is changed to "Already Setup". You can unclick to check box so that you can see the button appear once you close and open the database. Remember you can always hide the check box so that you can check for its value but the user does not see it.
 

Attachments

Users who are viewing this thread

Back
Top Bottom