Problems setting button visibility

ktimov1

Registered User.
Local time
Today, 08:42
Joined
May 18, 2010
Messages
19
I have a maintenance button on a form that I want to be visible/invisible based on user-level security access. However for testing purposes in the form_load I set the button to be invisible, but it is still visible. Here is the code:

Private Sub Form_Open(Cancel As Integer)

Me.btnMaintenance.Visible = False

End Sub

any ideas?
 
Try it on form_open

Edit, sorry I read your code. You mention form_load int he body of your post, and the code relates to form_open.

Do you get an error message or anything?
 
If the purpose of this button is an adminatrative task or only available to minority of users then by default the visible property of the button should be False. Then when the user opens the form it will only become visible if the user has rights. What you have not said is how you are determining the access level.
 
No errors, just acts as if the code isnt there.
 
Hmmm. That's a strange one. Does it say 'event procedure' in the on open of the form in the property window? And when you click the 3-dot button there, does it open the VBA editor and point to the correct event?

I'd try putting a break point in on the .visible=false line to see if it's going through the code.
 
As of right now I was just testing the visibility functionality and did not add in the user-level access.
 
Are you trying to do this via User Level Access Security? Not that I use it but I don't think it has this depth of control.
 
I'd put the code in the Form_Load, since Form_Open is too soon for a lot of things, but I'd look to see what code you have in the Form_Current event. Code in that event to control the visibilty would negate anything in the Open/Load events to so the same.
 
Wild stab in the dark here...is there confusion between 'Visible' and 'Transparent'? I know that in the past I have incorrectly made buttons invisible when I really wanted transparent.
 

Users who are viewing this thread

Back
Top Bottom