Need a code where file only opens if user is f.e "john"*7152008

  • Thread starter Thread starter J.Alladien
  • Start date Start date
J

J.Alladien

Dear All,

I need a code where a mdb only opens if user" john" is logged in, if f.e
user "patrick" is logged in i would like the database to display a message
and then automatically close. Please note that i already have a workgroup
with these members so it's just about the code!
Thanks in advance!
 
You need only use the CurrentUser method to check who the 'current user' is
and then act appropriately. Try something like:

if currentuser = "john" then
Application.FollowHyperlink "c:\Path2YourFile&FileName"
Else
MsgBox "You are not authorized to perform said action",vbCritical,
"Unauthorized Access"
Application.Quit
End if
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
Back
Top