Mile-O
Back once again...
- Local time
- Today, 12:26
- Joined
- Dec 10, 2002
- Messages
- 11,316
It was suggested in this thread that I post up a user class that I mentioned.
So, while my own is tailored to my database and much more complex, dealing with permissions, user levels, etc I've made a small example that can show what can be done.
So the User class.
All it does is load your database's user information into a class that can be referred to throughout your database, without having to do domain aggregate functions (e.g. DLookup) on your tables when you want to know something about the user. Simple, really.
In this example, all it does is open a different form based on a user level. So, there's three user levels (admin, auditor, and general). As the example won't know your info, it will prompt you the first time you open it to fill in that data.
It uses a hidden form that, when the database opens, checks your user level. If either admin, auditor, or general, it will open the relevant menu form. If a new user, you'll get a new user for, whereby you pick your user level.
Of course, this is quite simplisitic, but if your database involves permissions, preferences, etc. then it can be very handy to have user information to hand.
Effectively the class module is defined, and then its instantiated in module, under the line
This then allows you to refer to information you readily need
Any questions, let me know.
So, while my own is tailored to my database and much more complex, dealing with permissions, user levels, etc I've made a small example that can show what can be done.
So the User class.
All it does is load your database's user information into a class that can be referred to throughout your database, without having to do domain aggregate functions (e.g. DLookup) on your tables when you want to know something about the user. Simple, really.
In this example, all it does is open a different form based on a user level. So, there's three user levels (admin, auditor, and general). As the example won't know your info, it will prompt you the first time you open it to fill in that data.
It uses a hidden form that, when the database opens, checks your user level. If either admin, auditor, or general, it will open the relevant menu form. If a new user, you'll get a new user for, whereby you pick your user level.
Of course, this is quite simplisitic, but if your database involves permissions, preferences, etc. then it can be very handy to have user information to hand.
Effectively the class module is defined, and then its instantiated in module, under the line
Code:
Public ThisUser As New User
This then allows you to refer to information you readily need
Code:
ThisUser.Name
ThisUser.UserLevel
ThisUser.Email
ThisUser.Font
ThisUser.BackColor ' if you want to go all customisational!
ThisUser.ExportLocation
and so on
Any questions, let me know.