Only Admin can edit

hfsitumo2001

Member
Local time
Yesterday, 16:07
Joined
Jan 17, 2021
Messages
394
In the following marked in red field, I have block it to unable user to edit, because sometimes inadvertently, their cursor goes there and type it, while they wanted to do is to search item of supplies.

But there is a time that we need to edit an item code, how can we make it that only Admin that can edit that by disable the block and edit it.

What I have in my mind, and please correct me is like this: on Get Focus of the field, we use subfunction If Dlookup is Admin, Data property block is False, else Msg box " Only Admin that can edit item code"

End if

Will Admin be able to edit that?, Please give me sample of VBA code for this
AdmintoEditItemcode.jpg
 
probably just use OnCurrent
 
It's hard to say without knowing your login/authentication system. But, if you already have a dynamic for granular access (i.e. users and admins) than assigning a permission level to those users and using the "tag" property of the form control is the typical way to handle such things (from my experience anyway).
 
Personally, I like to prevent something from happening instead of letting it happen and then denying it. If you are going to do a permission lookup, why not do so when the form is loaded and enable/disable the appropriate form controls based on the persons permission status. Then, it won't even LOOK like its something that can be edited.

What I have in my mind, and please correct me is like this: on Get Focus of the field, we use subfunction If Dlookup is Admin, Data property block is False, else Msg box " Only Admin that can edit item code"

End if

Will Admin be able to edit that?, Please give me sample of VBA code for this
Have you tried this approach? Did it not work? I believe Isaac gave a suggestion on which event to place the code.
 
If you must crosspost, please say you have done so in the first post and provide a link to the other site
 

Users who are viewing this thread

Back
Top Bottom