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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restrict the Admin User?

Status
Not open for further replies.

JonWolgamuth

Technical User
Apr 19, 2001
53
US
(Previously Posted to the VBA Modules Group)

I have a database where users need to login. I'm planning on putting a shortcut to the database on each user's desktop so they don't continually have to choose their name from a combo box to identify work they've completed. The shortcut points them to the correct workgroup to use just for this database.

My question is that if they access this database in a way other than the shortcut, it allows them to login as Admin. I don't want to have to set a password for Admin, as this would cause the users to not be able to use other Access databases. (Is this right?)

Anyway, on startup of the database, I'd like to have some code which would check the login ID, and if they've accessed the database with "Admin" id, it would prompt them to login using the shortcut, and then close the database.

I can't imagine it would be a lot of code, but I'm VERY new at Access 97 VB, so I don't even know where to begin.

Thanks in advance!

Jon
 
VBA has a CurrentUser() function which returns the name under which the user has logged in. Just insert this into your startup code:
If CurrentUser() = "Admin" Then
MsgBox "Please use the desktop shortcut to open this database"
Application.Quit
End If Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top