need help to add user access level (1 Viewer)

majid4ever_w

New member
Local time
Today, 12:48
Joined
Jun 15, 2022
Messages
3
I have a small database with a login screen and a list of forms. I need to add a security level for the different users that some have access to all forms while others have access to some forms.
Hope anyone could help me to do this, please.
the file in the link below.




Thank you
 

Attachments

  • OPD Dispensing Verification - Copy.accdb
    2.3 MB · Views: 144

June7

AWF VIP
Local time
Today, 01:48
Joined
Mar 9, 2014
Messages
5,425
Common topic.

Exactly what issue are you having?

When user logs in, save their user ID somewhere, such as a global variable or tempvar or in textbox on form that never closes so it is always available for reference.

I have a process that doesn't utilize username/password login. I presume if they logged into network, they are legitimate users of db. I save their Windows username in table and when database opens, pulls username from Windows and matches to record in table to retrieve permission info.

However, all is meaningless if you don't take other measures to secure database, such as hide navigation pane, disable ribbon and shortcut menus, encrypt, etc. Also be aware many of these security settings can be overridden with shift-key bypass when opening database. Access is not really designed to be a secure database.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:48
Joined
Feb 28, 2001
Messages
27,001
Look up the topic "Securing a database" in this forum. Also, it never hurts to look at the titles / links in the Similar Threads list at the bottom the page.

The simplest answer to your direct question is add a field to the username table and set that to the user's role. Then when the user logs in, you save user ID and role (and name if that is also important/useful) in some convenient place, plus anything else you needed to remember. When the user opens a form, that form's Form_Open routine can fetch what it needs from the chosen retention method (see next paragraph) and decide what to do about/with that user. IF there is a record-level discrimination, you implement that in the Form_Current routine.

The most popular places for the user info are (a) a hidden form open to a single-record table with all required fields, which doubles as a way to keep a link open to a back-end DB in order to create a persistent connection; (b) public variables in a general module in the FE; (c) a TempVars structure which technically is somewhere in the FE workspace. Each has their advantages and disadvantages. Rather than burden you at the moment, I'll suggest that you do the search I named and follow through on some of those articles. They will touch on many topics, particularly if you follow links around.
 

bastanu

AWF VIP
Local time
Today, 02:48
Joined
Apr 13, 2010
Messages
1,401
Many ways to do that, here is a link to my sample:
Cheers,
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 17:48
Joined
May 7, 2009
Messages
19,175
this is a simple illustration of what you need.
i added a table tblForms that has the Names of all your forms.
then i added a field (AllowedForms) to tblUser, so you can pick which
forms a particular user can use.
when a User login, a TempVar is created with the list of Form names
the user is allowed to use
i added Module1 and add function fncCheckFormAccess() that will
check first if he is allowed to open the form. (see Macro on each button
of form LIST_OF_FORMS).
 

Attachments

  • OPD Dispensing Verification - Copy.accdb
    2.5 MB · Views: 185

majid4ever_w

New member
Local time
Today, 12:48
Joined
Jun 15, 2022
Messages
3
this is a simple illustration of what you need.
i added a table tblForms that has the Names of all your forms.
then i added a field (AllowedForms) to tblUser, so you can pick which
forms a particular user can use.
when a User login, a TempVar is created with the list of Form names
the user is allowed to use
i added Module1 and add function fncCheckFormAccess() that will
check first if he is allowed to open the form. (see Macro on each button
of form LIST_OF_FORMS).
Thanks a lot brother, it is working perfect.
Appreciate your help
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:48
Joined
Feb 19, 2002
Messages
42,981
And, here is a link to my sample:

 

Users who are viewing this thread

Top Bottom