Could you please tell me why the hide command buttons code is not working. It works in the my database named sample database, but not this one. I want to use one menu and hide certain buttons from certain users. I am trying in in 2007 and 2016.
Could you please tell me why the hide command buttons code is not working. It works in the my database named sample database, but not this one. I want to use one menu and hide certain buttons from certain users. I am trying in in 2007 and 2016.
Well that looks familiar!
The code doesn't know what the AccessLevel is for the logged in user
Suggest you add a function GetAccessLevel in a standard module.
Use a DLookup to get the value for the logged in user
Then change the code on your form to reference the function
EDIT: As I'm now at my computer I looked at it properly
As well as the above comments (now done), you cannot hide a control that has the focus
So I've added a Close button to that form and set focus to that when the form loads
The modified code now shows/hides the button correctly
Last edited by isladogs; 02-16-2019 at 06:17 PM. Reason: More info & attached file
I know that I have only been working on this for a few hours, but it seems like a week. I can't figure it out. I have attached the one the have been working on.
I have really been stressing about this. But I think I understand now. Please correct me if I am wrong.
I was trying to log in as another user to test and see how it works for each button. But the code that you added actually makes the command buttons visible or invisible according to the computer login. So if I log in on my computer it shows certain buttons as to where if I logged in on Kyle's or Amber's computer it would show different buttons according to the access level. I hope I am understanding this correctly. That would be really awesome.
I can't tell you how much I appreciate all your help. I am feeling more secure about doing this database all the time. I have the ability to make tables, queries, forms and reports to do most of what I want to do in a database. But I did not know anything about security. And when it comes to code, I have no knowledge. It is like a foreign language. However I am learning bits and pieces.