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

storing usernames as they logon?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
anyone got ideas on writing those usernames to the db as they log on and off the db?
also, the times [but i can at least do this - hurray!]
what do i use to reference the users ...my guess is environmental variables, but i have little / no experience with these.
help will be greatly appreciated...cheers in advance
 
I created a table called tblUsers and I use this piece of code in the AutoExec macro. The table has teh fields User, DateTime and Database. This allows me to track multiple databases with one table.

Public Function AdminCheck()
DoCmd.SetWarnings False
Dim CrUser As String
Dim StrSQL As String
CrUser = CurrentUser()

If CrUser = "Admin" Then
DoCmd.OpenForm "frmAdminCheck"
Else

StrSQL = "INSERT INTO tblUsers ([User], [DateTime],[Database]) VALUES ('" & CrUser & "', Now() , 'Compliance Dev Front End');"
DoCmd.RunSQL StrSQL
DoCmd.SetWarnings True
DoCmd.OpenForm "frmStartup"
End If
DoCmd.SetWarnings True
End Function

This code also checks if the user is logging in as admin and if so puts in an additional password screen that only myself and other legit admin know how to get past.
 
COOL! hey thanks JaneInMa! [again]
just curious, what's on the form frmAdminCheck?
i'm thinking of making a "useful" form which will contain the logon/logoff data ... is that what it is?
 
The Admin Check is a form that states in large font that if the user is a legit Admin user then type in the password, otherwise contact the DBA ASAP. It has one field for them to type in a password (with a password input mask).
The ok button checks the password if it is correct it opens the database otherwise I return them to the screen. The cancel button closes the whole database.
It protects the database from anyone using the default security workgroup.
 
thanks again JaneInMa!

deducting from your code, is it safe to assume that the data we're interested in gets written AFTER a userdata has been validated and given access? [if no, ignore the rest]

cos i am also interest in maybe loging failed attempts, for obvious reasons, any suggestions there,
 
Yes, all this happens after the user has entered the password. If you are trying to set up password timeout say after three attempts my guess is you will have to program that yourself not setting up microsoft security.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top