Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Security rights please help

Status
Not open for further replies.

simpsondm

IS-IT--Management
Jan 14, 2003
21
US
Could someone please answer a question and if possible and example. What my problem is I have a projects database that many people use I am not a developer but am learning the hard as you go way and so far the database has worked out well.

My issue is I now need to lock it down some and what I have been asked to do and I have no clue how to or if it is possible is set it up so that depending on the user and or group they can browse all projects but can only edit the projects that have been assigned to them the person. What we call the project lead. I have it the database setup so that it pulls the users network login name when the go to login to the database is it possible to also have it determine and set the rights based on the users name?

Has anyone done this or could you please give me advice and maybe and example/code to work with. I really like to figure these things out but I only have 2 days to complete this.

Thanks
David
 
yes.

1.create (and fill in) a user table including username and rights as fields.

2.create a form (i.e. GetUser) and include a field on it that has the username(you said you were able to grab this).

3.create a query based on the table you created in Step1 and in the username criteria specify Forms!GetUser!username.value. (Note: Be sure that whatever you name the username on the invisible form is what you specify in the query criteria. If not you will get an error message.)

4.create another form (i.e. Validate) bound to the query you just created in Step 3.
be sure to include rights and username as fields on your form.

5.add a command button (i.e. captioned "Enter System") to your Main form (the form that opens when the database is initiated) that allows the users to enter the system.
within its On Click event include an If statement like the one below:

If Forms!Validate!rights.value = "user" then
Docmd.openform "userform"
else
If Forms!Validate!rights.value = "admin" then
Docmd.openform "adminform"
else
msgbox('You are not authorized to use the system')
endif
endif

The sequence of events that should happen:

1Open Main Form (performed by user)
2From the On Load event of the Main form open GetUser and Validate as invisible.

DoCmd.OpenForm "GetUser", , , , , acHidden DoCmd.OpenForm "Validate", , , , , acHidden
(performed transparently by code)
3Click the Enter System button on the Main form (performed by user)

The idea is to create an opening screen for your users and admins and whatever other levels you have.

So, if I log in and it queries the user table for my username, and returns 'user' as my rights, then I will see the User form.

i hope this helps you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top