p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   Permissions on DB without user-level security (http://p2p.wrox.com/showthread.php?t=42414)

nbourre May 11th, 2006 10:30 AM

Permissions on DB without user-level security
 
Hi,

Is it possible to set permissions on a MDB file without using the user-level security?

I'm working on a project and it will be copied on many computers on the field (No network connection). I want to protect the structure and other things from the coordinator who will only enter the data into the database. If I use user-level security, the DB cannot be opened on foreign computers.

By example:
When the user open the MDB file a form appears and ask for the login and password.
Depending on the user group, permissions are granted for a number of objects.

Is it possible to program that in VBA?

Thank you

Nick


mmcdonal May 11th, 2006 11:50 AM

Yes, I do this a lot with contracted solutions. The idea is that in VBA, it is "Lite" security since it can be hacked pretty easy.

Create a table with Groups. Then create a table with usernames, passwords and whatever information for the user, and a GroupID FK. This is your access structure.

Be sure to hide menus when the database is opened.

The first form is modal/pop up, and asks for login credentials. Use Password formatting for the password field on the form and in the table. This form then checks the tables for proper authentication matches, and then opens a hidden form with username and group.

All the rest of your forms should refer to the hidden forms for proper access. What I do is segregate functions on seperate forms, and then unhide linking buttons based on the user's group credentials.

For each of your events, you have the option of going out and checking the group on the form, like this:

If [Forms]![frmHIDDENLogin].[Groups] = "Administrator" Then
   DoCmd.OpenReport 'etc
   Else
   MsgBox "You do not have access to this report." & vbCrLf & _
          "Please see the database Administrator for access."
End If

That sort of thing.

If [Forms]![frmHIDDENLogin].[Groups] = "Administrator" Then
   Me.btnAdminForm.Visible = True
   Else
   Me.btnAdminForm.Visible = False
End If

Is this helpful?



mmcdonal

djcrawn May 31st, 2008 08:36 AM

This is a little helpful to what I am doing, but I have a little different way that I want to use it. I want for the users to be able to login and use the switchboard. I want to have different switchboards based upon access. I also want them to be able to change their password. I am new at VBA programming and am having trouble setting up the queries. Can this be done? is there anyone who can help me through this programming?

Dean J. Crawn

mmcdonal June 2nd, 2008 06:53 AM

Yes it can be done. I would not use the built-in switchboard though.

You can also allow your users to change their passwords. Just give them the proper form and pre-populate the Username field based on their actual login identity (if that is feasible.) Then have them type their current password, and then type the new password twice, etc.

Can you work with forms without using the Switchboard wizard?

mmcdonal

Look it up at: http://wrox.books24x7.com

djcrawn June 7th, 2008 08:09 AM

Yes I can, I just need help in setting up the menus so that I can limit access upon their login.

Dean J. Crawn


All times are GMT -4. The time now is 01:17 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.