Sorry, I deleted my post. I didn't ready your entire question so I sort of answered the first part. I use AuditTrail to log changes in my tables in Access. I've never really tried to log users, but I can see the benefits to doing it.
I was thinking about adding a record to a table every time the login button is clicked but i have no idea if this is possible and if it is how can it be done?
Search for code written by Dev Ashish for
Function fOSUserName()
If this will work for you to record the user...
You will need
a/ A table with the fields User, and Date in the default property for Date type "Now()" without the quotes. This will automatically record the date and time.
b/ Create a Module in your database for Dev Ashish's code (cut and paste his code into your module) Debug and then save it.
C/Create a textbox, in the default properties of your text box type "fOSUserName()" without the quotes.
D/Make the text and the textbox invisible.
E/ Create a form with a button that says Login. In the button properties, create a Click event (Probably a Macro) which will create a new record in your table. In the macro Save the Record. And then in the Macro close your form.
Edit: I tried it and it worked but I did have to add one thing:
You will need to create one additional field in your table and corresponding text box which which will be visible on your form....such as Enter Your Initials Here ___. You must enter text somewhere to actually create the new record, then everything else should work.
If all you want is a technique to record some text to an external file, here is a routine.
I used this to write records to a file. It was helpful in finding information on various items. The APPEND option allows you to keep adding records to the file.
It depends on how structured/unstructured you want things as to how useful this will be to you.
This function let's you write a time stamped record to a file.
When I set up some processes to do things monthly or based on some subject, I included a call to this function. It was easy to see some of the history of events.
The call to the function was within Access vba.
'The entire file is outside of Access.
You can open the file with Notepad, NoteTab, textPad.......
Code:
Function fJLogIT(sActivity As String)
'write a record into an access log file called jAccessLog.Log
'to indicate what files/databases have been used recently
'written Mar 2000
'jed
'Parameter:
'sActivity a short text about activity in this current database, can be null
'my complete file identifier
Open "E:\Work_DATA_20071207\C_Drive_WORK\Jack\WorkInProgress\jAccessLog.log" For Append As #1
Print #1, Now() & vbTab & CurrentDb.Name & vbCrLf & vbTab & "---> " & sActivity
' Close before reopening in another mode.
Close #1
End Function
If you create an empty text file, then you can use that file name in this function.
In your vba, just use something like
Code:
fjLogit("Executing routine modLogTest to check new language profile")
and it will record the record to the file.
Good luck.
some sample records
Code:
4/21/2011 2:05:19 PM E:\Work_DATA_20071207\C_Drive_WORK\Jack\WorkInProgress\MoveA2K.mdb
---> Searching for records from boxes/cabinets
12/1/2011 3:59:03 PM D:\db1New2009.mdb
---> List of linked table details for D:\db1New2009.mdb is at c:\jack\workinprogress\LinkedTbls.log
12/14/2012 2:20:19 PM D:\db1New2009.mdb
---> Executing routine modLogTest to check new language profile