Tracking who opens a form

  • Thread starter Thread starter CFP - Russell
  • Start date Start date
C

CFP - Russell

Guest
Hello Everyone,

I am new to access and I am designing a database for a small company. I would like to be able to track who opens a particular form. Can someone please help me with this. My boss wants to be able to run a report and see the time and username of everone that has accessed the form. Right now I have it set up recording an audit trail when changes are made, however I cannot figure out how to log the opening of the form.

Any help is greatly appreciated.

Thanks,
Russell
 
You could create an On Open event for the form that could append a record to a table containing the user name, time, and form name. Then base your report on the table.
 
Russell,
Insert the following into a basic moduel

Public Function LogForm(strForm As String, strWho As String) As Long
CurrentDb.Execute ("INSERT INTO tblFormLog ([Form], [Who], [When]) VALUES ('" & strForm & "', '" & strWho & "', #" & Now & "#);")
End Function

and insert the following into the forms open or load event

LogForm Me.Name, CurrentUser

change varables and field names where nessissary
 
Thanks so much for the informative posts. I am however very new to access and I am not sure what to replace in that code with my own.

The name of the form I am working with is 'Customers' and the table I would like to store the data into is 'UserLog'

Thanks Again,
Russell
 
Replace tblFormLog with UserLog and replace the three field names ([Form], [Who], [When]) to the field names in the UserLog table that you are wanting to store the respective data.
 
Thanks that works great however for the username Admin comes up. Is there a way to show the Login Name?

On my audit trail table there are two fields, one is 'User' and Admin shows up.

The other is 'LoginName' and Russell shows up.

I would like to have Russell show up in the UserLog table in addition to admin.
 
One appears to be the default Access user and the other looks like your capturing the name of the user that is currently using the app.

Are you interested in doing something like capturing an NT user name or a username that is assigned to the user when they login from a custom login form?

Which ever way you are captureing the User's login name just pass that to the table, if you want to capture multple sources add more fields to the UserLog table.
 
Yes I am interested in capturing a windows NT username. I'm not sure how the audit trail form catches that information. Do you know of an easy way to catch that information. I can send you the database I am working on if you wish.


Thanks,
Russell
 
Russell,

Use the Search facility here and look up "NT Username".
There are several examples.

Wayne
 

Users who are viewing this thread

Back
Top Bottom