Restrict a field on a form by User? (1 Viewer)

Lilly420

Registered User.
Local time
Today, 01:59
Joined
Oct 4, 2013
Messages
126
Hello,

I need some help please. I have a Access 2010 Tracking DB which contains a tracking form which a user can input data regarding an exam and there is a combo box which lists manager's names and stores that ID in the table, so the manager comes in and approves what the user put in--they choose their name from the approval dropdown box and then the fill in the approval date in another field. Well, the managers want to restrict this field so only they can choose from the approval list and put in the approval date...is that possible?

The two fields are:

2ndReviewerID
2nd Review Completion Date

I did search and did not find anything. My apologies if I missed it.

Any help is appreciated.

Thank you.

Lilly
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:59
Joined
Oct 29, 2018
Messages
21,467
Hi Lilly. There are two ways to "know" who the user is, so you can restrict their access in your database. (1) You can create a login form, so the user can self-identify, or (2) use the company's network domain login information. Either way you go, you'll need to create a table listing all the managers, so you can tell based on the login who to restrict access or not.
 

Ranman256

Well-known member
Local time
Today, 01:59
Joined
Apr 9, 2015
Messages
4,337
I have a tUser table with user's rights.
USERID, FIRSTN, LASTN, LEVEL
bob12, bob smith, M
pam4, pam jones,""
xman, charles, xavier, F

when user opens the db, the main menu form will open and grab the userID.
stores it in an invisible text box.
Then lookup that persons rights in order to enable/disable controls.

Code:
sub form_load()
dim vLevel

  txtUser =  Environ("Username")      'get userID,visible in all forms

'get level from user table
   vLevel = Dlookup("[Level]","tUsers","[userID]='" & me.txtUser  & "'")

'now, enable/disable items on form
   select case vLevel
         case "A"  'admin 
             'all is enabled

         case "U"  'normal user
             txtBox1.enabled = false
             txtManager.enabled = false

         case "M"  'manager
             txtBox1.enabled = false
   end select
end sub
 

Lilly420

Registered User.
Local time
Today, 01:59
Joined
Oct 4, 2013
Messages
126
Hi thank you so much. I think this is what I need but need some help please.

So I create a user table with all the people that will be using the database and assign a level to them correct?

The tUser table would consist of four fields?

User ID: Lbloom3 (this is your log in ID correct?)
Last Name: Bloom
First Name: Lilly
Level: M

Then I create a form that should open when the user signs in and I apply the code above to this form?

Currently I have a navigation panel that opens when they enter the DB and they select from the panel to go to a certain form or report…does this get affected?

And when this is done, how do I apply this to a field on a form?

Sorry, I am a confused, I have never done this before, could you step it out for me? I truly appreciate the help.

Lilly
 

Users who are viewing this thread

Top Bottom