As Douglas says above but just in case you need a bit more info here is what
I use.
First create a new table call tblActivity with fields :-
ObjectName (Text, Size=255, Indexed=Yes(No Duplicates)
ObjectTitle (Text, Size=255)
FirstDate (Date/Time)
LastDate (Date/Time)
Counter (Number, Long Integer)
Next paste the following Sub-Routine into a module.
'-----------------------------------------------------------------------
Public Sub UpdateActivity(vObjectName As String, vObjectTitle As String)
'Update tblActivity with new data or create new record if first time object
used
'Entry (vObjectName) = name of object (frmOrders, rptInvoice, etc)
' (vObjectTitle) = title of object (Orders form, Invoice, etc)
'Exit New record added or existing record updated in tblActivity
Dim vTitle As String
If vObjectTitle = "" Then vTitle = vObjectName Else vTitle =
vObjectTitle 'if no 'Caption' then use Object name
If Nz(DLookup("ObjectName", "tblActivity", "ObjectName = '" &
vObjectName & "'")) = "" Then 'if record does NOT exist then
CurrentDb.Execute "INSERT INTO tblActivity (ObjectName, ObjectTitle,
FirstDate, " _
& "LastDate, Counter) VALUES (" _
& "'" & vObjectName & "', " _
& "'" & vTitle & "', " _
& "Date(), " _
& "Date(), " _
& "1)"
'create new record
Else
CurrentDb.Execute "UPDATE tblActivity SET Counter = Counter + 1,
LastDate = Date() " _
& "WHERE ObjectName = '" & vObjectName & "'"
'update existing record
End If
End Sub
'--------------------------------------------------------------------------
Now copy this line into the Open event of all forms and reports (but NOT
subForms or subReports) :-
UpdateActivity Name, Caption
Whenever a form or report is opened a new record will be added to the table
or an existing record updated with the current date and the counter field
incremented by one. You can then easily create a report or form to display
the saved data.
Please let us know if that was useful, it may help others.
--
Peter Hibbs
"Douglas J. Steele" wrote:
> Create a table, and put code in the report's Open event to update that
> table.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Barry" <(E-Mail Removed)> wrote in message
> news:22EADF3B-167E-4194-BC8A-(E-Mail Removed)...
> >I need to create a table that will log every time a report is opened so i
> > have a log showing which reports are being used and which are not.
> >
> > Anyone have any ideas?
>
>
>