|
Question : Track user logon/logoff to the access database.
|
|
Hi Everyone,
I’ve got a bat logon script (see below) which logs when users logs on and off, which adds the information to the csv file. I’m now trying to figure out the way to send the data directly to the MS Access file. Is there an easy way to achieve it?
logon script: echo %username%, on, %computername%, %time%, %date% >> "\\server\share\logon.csv"
logoff script: echo %username%, off, %computername%, %time%, %date% >> "\\server\share\logon.csv"
|
|
Answer : Track user logon/logoff to the access database.
|
|
Just create a .mdb with a module named "module1" and a function named "fncSaveuser" with the code
Function fncSaveuser()
CurrentDb.Execute ("INSERT INTO tblCaller ( Caller ) SELECT Environ('username') AS expr;") DoCmd.Quit
End Function
Now create a macro named "saveuser" with: Action: OpenModule ModuleName: Module1 ProcedureName: fncSaveuser
Make sure the table (here tblCaller) and the field(s) are defined and in the INSERT statement. Now create a .bat file with: "C:\Program Files\Microsoft Office\Office\Msaccess.exe" "C:\Data\Access\UserLogon.mdb" /x saveuser
Make sure the paths to Msaccess.exe and you .mdb are correct and run the bat file.
Clear ?
Nic;o)
|
|
|
|