The Mgt wants to be able to log who is using the database(by system #), but they don't want me to assign user groups because then someone would have to maintain them. Is there a way to do this. Thanks
Personally, I like the following code because it is simpler. Call the subroutine from an appropriate place in the application such as the On Open event of the starting form.
[tt]
AuditTrail table
RecID Autonumber
LoginName Text ' Access login
UserName Text ' Windows Username
AccDateTime date/time ' current datetime
Sub AddAuditRec()
Dim db As Database
Set db = CurrentDb()
db.Execute ("INSERT INTO AuditTrail (UserName,CompName, AccDateTime) SELECT CurrentUser(), '" & Environ("username" & "', Now();"
db.Close
Set db = Nothing
End Sub[/tt] Terry Broadbent
"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
Excellent reference. Thanks. Terry Broadbent
"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
JUst a brief not of caution. For the ".LDB" file approach, you NEED to be aware that the file IS NOT an accurate reflection of who is currently "Logged On" the db. It is an internal system file for record locking and may (often does) include the "names" of users who have been logged on - but who have logged off and gone on to other endeavors.
For the Ms. Soloution, the file/table of users will ONLY be an actual list IF no user has exited the system via any path other than the Startup form. This INCLUDES users who have simply turned off their machines, those who have had their system 'Crash', the ones who got tired / lazy and jsut used task manager to "Kill" the app ... Further, to even make the process semi-reliable, you need to remove ALL of the normal exit paths, such as the "Close" button on the titlebar, the Exit item on the file menu, the Open Item on the file menu, The Close button on the database window title bar ... I really don't know how many others. The capability to use the immediate window ... (Yes Dorthy, typing quit into the immediate window WILL CLOSE Ms. Access). Stop users from creating or modifying Macros and procedures ...
If you still think maintaining the users and groups is less "trouble" than the above, then you should "Go For It". But JUST one more item. To be useful, you not only need to know that a user was "in" the data base, but what the "DID", as in records added/edited/modified. There is an Wxcellent FAQ (pat my back, pat my back, pat my back) on maintaining a transaction log for Ms. Access faq181-291 which is useless if you do nnot have "proper" usenames.
O.K. No more 'soap box'.
MichaelRed
mred@att.net
There is never time to do it right but there is always time to do it over
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.