Hack #58. Implement Unique Usernames

Even when Access Security isn't active, you can implement unique usernames when all users are Admin.

Access Security is great in many multiuser situations because you can assign rights to groups and individuals. However, sometimes this is just a lot of overhead. In a small group of users who all use the same objects, you don't get much added value by implementing security.

The downside of not using security is that all users are given the name Admin. You can confirm this in an unsecured database by going to the Immediate window (Ctrl-G in the VB Editor) and typing the following:

	?CurrentUser

The CurrentUser property contains the logged-in name of the user. When security is on, each user has a specific name. When security is off, all users are Admin.

An easy way to use specific names in an unsecured database is to first have users enter their names and then have the entered names available throughout the session. This technique makes sense only in a configuration in which each user works on a local database with the forms. The data tables remain on in a back-end database on the server.

When a user starts up her client-based front end, she is asked to enter her name. This is just an easy affair handled by an input box. A loop keeps testing for her entry, and when she is done, the entry is handed off to the Tag property of the main form. This works best if the main form opens automatically when the user starts up the database. This code goes into ...

Get Access Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.