Here is a Users And User Groups Example Database (1 Viewer)

Was this database example helpful?

  • Somewhat

    Votes: 0 0.0%
  • No

    Votes: 0 0.0%

  • Total voters
    1

hk1

Registered User.
Local time
Today, 02:42
Joined
Sep 1, 2009
Messages
121
I've been working on an example database to demonstrate how to program your own Users and User Groups module. Feel free to download and test this database and then post your feedback here.

This was written for Access 2007 and 2010 but the file format is 2002/2003. You should easily be able to make this work in 2003 by change the two TempVars I've used to be Global variables instead.

There is no error handling anywhere other than the one or two On Error Resume Next statements I used where necessary. This is intentional and I realize that in the real world your database needs error handling.

This does not integrate at all with Active Directory users and groups or your local Windows users and groups.

Also, this is based on the idea that users will login when they start the app and will then the same user will be logged in until he/she closes the application or clicks the log off button. I realize that some people would probably prefer a system where the user enters a user code for every screen. This is not designed with that capability.

Also, there is currently no way to raise your user level to log into one of the administrative screens. The only way to access an administrative level screen is to log out and log back in as a user who has the right permissions.

I did not design any special groups or users. You can delete all of the users and groups if you like and create your own with whatever names you want to use. Do keep in mind that if you choose to do this you will likely end up editing information in the tables because at some point you'll be unable to access any of the forms after you've deleted enough user/group records. You need to have at least one group configured with full rights and one user assigned to this group but I did not write any code to enforce this.

I did employ some basic security techniques but they are not good enough for the real world. Instead of storing the password I'm storing a one-way hash. This hash is generated using a very simple, unsecure hash generator. The one I would have preferred to use cannot be legally distributed in demo applications due to licensing restrictions. I'm also using basic encryption to store the form names. This would make it slightly more difficult for a user who has access to the tables to choose to give himself access to to forms and functions he wouldn't normally have access to. However, any user who has access to the tables could create a real mess by deleting records or clearing certain fields. Access to tables is an entirely different security issue and I've chosen not to tackle that in this example.
 

Attachments

  • UsersAndGroups.mdb
    552 KB · Views: 733

boblarson

Smeghead
Local time
Today, 01:42
Joined
Jan 12, 2001
Messages
32,059
One thing - Your sample is not usable by anyone with 2003 or below currently because you used a 2007/2010 feature - TempVars. You would have to rewrite it to not use that in order for it to work with the lower versions.
 

hk1

Registered User.
Local time
Today, 02:42
Joined
Sep 1, 2009
Messages
121
Yeah, you are right.

This was written for Access 2007 and 2010 but the file format is 2002/2003. You should easily be able to make this work in 2003 by change the two TempVars I've used to be Global variables instead.
 

boblarson

Smeghead
Local time
Today, 01:42
Joined
Jan 12, 2001
Messages
32,059
Yeah, you are right.

So, why don't you convert it for others who might not see that line or know how to do it? I'd move it to the samples category here if it was made so anyone can use it.
 

hk1

Registered User.
Local time
Today, 02:42
Joined
Sep 1, 2009
Messages
121
OK, I've uploaded a new version of the example that now should work in Access 2002/2003. I didn't test it in either one so I don't know for sure.

As already mentioned, the difference is that this version uses global variables instead of TempVars. TempVars are much better because they will survive a reset which is very helpful during development. However, TempVars are not available in anything older than Access 2007.
 

Attachments

  • UsersAndGroups2002-2003.mdb
    568 KB · Views: 349

Users who are viewing this thread

Top Bottom