Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Users/Groups in VBA

Status
Not open for further replies.

pervinpj

Programmer
Jul 10, 2003
11
0
0
US
Using MS Access 2000, I need to make a main menu that is different depending on the group the user logged on as. I've figured out how to display the username, but not how to nab what group they are logged on as. Does anyone know how to accomplish this?
Also, it's a long shot, but would anyone know how to access usergroups, userpermissions, etc. using VBA?
 
Answered my own question again (I think):

I used this function:

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

to nab the username, and used the result in the where clause of a query filled with usernames (only the nabbed username is shown), anything I wanted to restrict access to, and Access data modes so that when a form is opened, access is restricted to it (all forms are now opened with the DataAccessMode (I think that's it) parameter set to the Data access mode from the query. If an unknown person attempts to log on, the username is appended to the users table, and Security level is left blank, and they are given read-only access to some of the forms (depends what I want them to view). At the end of the day, an E-mail is sent to the database administrator with the user names that have no security level assigned. They are either assigned the "Blocked" security level (in which case the d-base closes every time they log on, and they get a nasty-gram message on their screen), or they get a security level assigned.

I also used the Bypass key tip from this site (turn off the bypass key) to eliminate people going around my security.

Please let me know if you have any comments (feel free to crush my spirits for the betterment of my database), or questions about my security measures, please respond.

Thank you,
Paul Pervinkler
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top