PDA

View Full Version : Acess rescritions at the time of login...



sindhuja
07-09-2008, 04:45 PM
Hi All,

Here is my requirement....

i have created a login form with the fields username, password, login button and the exit button. this form also includes the option of save my username and password. Once this is selected username and password should be displayed automatically in the txtusername and txtpassword field.

need to create a table named tbllogin with fields username and password and also new password. At the time of new user the default password should be same as username.

Should also ask for the change of password option. Once the user change the password it should be stored in the newpassword column of table tbllogin.

Also i need to specify the access levels to the form.
1) Admin - access should have acess to alltheforms and reports (full access)
2) Sr Ass - should have access to certain forms and reports
3) Ass - should have access to only some forms.

Am not sure how to specify these access level...:doh:

Can anyone helps me out in this... Also the attached the sample form...
Am newbie to access...:help

Regards,
Sindhuja

CreganTur
07-10-2008, 09:47 AM
First of all, I have to congratulate you for some really good form design- you renamed your objects with unique names, which is a very good thing to do. For someone who is a 'newbie' to Access, you show a good understanding of best practices :thumb

I tinkered with the db you provided and created a Table that contains user names, passwords, and status. This table will hold the data that your form will be referencing to validate any login attempts.

If the user inputs invalid data, then a warning msgbox appears. Otherwise, if the username and password are good, then a DLookup function will look to see what that user's status is. From there it will open up a switchboard based on the user's status.

Having a different switchboard for each of your status types (Admin, Sr Ass, Ass) will restrict what that user can do. As long as you hide the database window, they won't be able to do anything other than use the buttons you give them on the switchboard.

This doesn't meet all your requirements, but I hope that it will give you a good starting place.

NinjaEdithttp://img293.imageshack.us/img293/9060/ninja3od8.gif: Here are the 3 different User Name / Password combinations I placed in the table:

JohnSmith | 123456
JaneDoe | 123456
JohnShepard | 123456

sindhuja
07-10-2008, 04:55 PM
Hi CreganTur,

Thanks a lot for the quick response.

One more query ! In the sample file, three forms has been created. My requirement is i should have a common home page with different headings. Depending upon the status of the person logged in access should be given read, write, delete and edit access to the specified headings and forms.

Also can anyone help me out in retrieving the username and password automatically when the save my username and password checkbox is clicked.

Regards,
Sindhuja

CreganTur
07-11-2008, 05:43 AM
Depending upon the status of the person logged in access should be given read, write, delete and edit access

The only way I can think to accomplish this is to make use of the DLookup function to get the status (you'd have to do this for each form) and then run a Case Select that will enable or disable controls on the form based on the status.

To make things easier you could have the login procedure create a gobal variable, the value of which would be the status of the person who is logged in. Then you could just refer to that variable to check the status and then run your case select statements.

Now, if there's a form that you don't want the User to be able to open if they don't have the right status, then there are 2 ways to accomplish this:

1) The easiest way is to create unique switchboards for each of the different statuses. If there's a form you don't want them to get to, then you just don't put a link for it on the switchboard.

2) Create a procedure for the OnOpen event for the form that looks at the status. Something like:
If Not status = "Admin" Then
DoCmd.Close '<<<close the form
MsgBox "You do not have correct permission to access this form."
Exit Sub
End If

sindhuja
07-12-2008, 07:27 AM
Thanks a lot ! Let me try this and revert if i face any issues....

Regards,
Sindhuja