Simple Open/Close Audit Trail

Status
Not open for further replies.

___

¯¯¯¯¯
Local time
Today, 06:35
Joined
Nov 27, 2003
Messages
595
This is a very simple example of logging every time the database is opened or closed to a text file.
 

Attachments

Last edited:
Durien512 said:
COOL... i am borring it!

Hi,

Please let me know when you've returned it so I can also have a look

Thanks...;)
 
If I place this in my BE this will tell me who is in my Database on the network at all times?
 
I don't understand how this works, but it does. Is there a way to have the log file appear on a network drive? If yes, how?

Thanks

Mike
 
Mike Hughes said:
I don't understand how this works, but it does. Is there a way to have the log file appear on a network drive? If yes, how?

Thanks

Mike

Modify the code to show your network drive

Code:
Private Sub Form_Close()
Dim FileNum As Integer

    FileNum = FreeFile
    
    Open "[COLOR="Red"]C[/COLOR]:\DatabaseLog.txt" For Append As #1
    Print #1, "Database closed by" & " " & Environ("UserName") & " " & "using computer" & " " & Environ("ComputerName") & " " & ":---:" & " " & Now(); ""
    Close FileNum
    
End Sub
 
Bigmo2u said:
If I place this in my BE this will tell me who is in my Database on the network at all times?

Yes it will
 
I use a sumple logging table in my database but this also seems a good idea. What I can't understand is what the variable 'FileNum' does especially as it is dimensioned as an integer and its value set with what I can only assume is another integer variable that is not in the code.

Can the author please explain?

Ta
 
Excuse my lack of access skills on this one, but where is the code?

I cannot find it in the example database. All I see is the macro to open the form and the form itself.
 
If you've opened the database you can use Alt+F11 to reveal the code. If you still can't see it, make sure the View>Project Explorer taskpane is selected and you can double click any object there to show the code. Least that's what I've been using lately...
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom