Simple Open/Close Audit Trail (1 Viewer)

Status
Not open for further replies.

___

¯¯¯¯¯
Local time
Today, 15:57
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

  • txtfilelog_A2K.zip
    15.3 KB · Views: 2,390
Last edited:

Groundrush

Registered User.
Local time
Today, 15:57
Joined
Apr 14, 2002
Messages
1,376
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...;)
 

Bigmo2u

Registered User.
Local time
Today, 09:57
Joined
Nov 29, 2005
Messages
200
If I place this in my BE this will tell me who is in my Database on the network at all times?
 

Mike Hughes

Registered User.
Local time
Today, 15:57
Joined
Mar 23, 2002
Messages
493
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
 

Groundrush

Registered User.
Local time
Today, 15:57
Joined
Apr 14, 2002
Messages
1,376
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
 

Groundrush

Registered User.
Local time
Today, 15:57
Joined
Apr 14, 2002
Messages
1,376
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
 

Fear Naught

Kevin
Local time
Today, 15:57
Joined
Mar 2, 2006
Messages
229
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
 

sdzc

Registered User.
Local time
Today, 09:57
Joined
Mar 27, 2004
Messages
46
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.
 

WrHn85

Registered User.
Local time
Today, 07:57
Joined
Jul 9, 2006
Messages
31
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

Top Bottom