I have been trying to find the code that, when a user logs into an ACCESS 2003 database, this users information is logged to a an external text file. I do not want it to be tracked in the database itself, but I want it to append to a text file. Any direction on this would be appreciated.
Sandra
Microsoft ApplicationsMicrosoft DevelopmentMicrosoft Access
Actually, this worked out just waht I wanted. With a little tweaking, it appends the data as I want. thank you
Sandra.
Jeffrey Coachman
You can get the current user name with the CurrentUser Function:
CurrentUser()
So you would change my code above to something like this:
Private Sub Form_Open(Cancel As Integer)
Dim FileN As Integer
FileN = FreeFile
Open "c:\YourFolder\DBLogFile.txt" For Append As FileN
Print #FileN, Chr(13) 'Carrige Return
Print #FileN, CurrentUser()
Print #FileN, Format(Now(), "mm-dd-yyyy hh:nn:ss")
Close FileN
End Sub
Use the network login; without User Level Security in Access, every call to CurrentUser() will return 'admin', which makes it worthless.
Jim.
Sandra Smith
ASKER
I have been using the Network login. I have a function that returns this as we cannot use User Level Security where I am so all my databases relay on the Network login. Thank you both for your advice.
Sandra.