R
Rick B
I want to create a table and track the usage of reports and forms. Since
Access can't tell you when an object was last used, I will do it myself.
This will let me delete old forms and reports without worrying that someone
somewhere might still need it.
I want to create a public function that I can insert into the OnOpen event
of every report and form. I don't want to copy and paste the same code into
every single object if the code turns out to be 5 or 10 lines.
I will build the function as below. this is just air code that I threw
together and know that it needs at least a little work.
I have a few questions. How do I call this function from the OnOpen event
of my report and send the report name over to the function? Also, can
someone look over my code and see if they see any problems?
Thanks for your help. If there is code out there somewhere that already
does this, let me know. I would hate to reinvent the wheel here!
Rick B
----------------------------------------------------------------------
Public Function LogUsage()
DimVarObjectName as String
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tblObjectLoging")
With rs
rs.Edit
rs.AddNew
rs![Object] = VarObjectName
rs![Date] = Date()
rs![UserID] = fOSUserName()
rs.Update
End With
rs.Close
Set rs = Nothing
End Function
Access can't tell you when an object was last used, I will do it myself.
This will let me delete old forms and reports without worrying that someone
somewhere might still need it.
I want to create a public function that I can insert into the OnOpen event
of every report and form. I don't want to copy and paste the same code into
every single object if the code turns out to be 5 or 10 lines.
I will build the function as below. this is just air code that I threw
together and know that it needs at least a little work.
I have a few questions. How do I call this function from the OnOpen event
of my report and send the report name over to the function? Also, can
someone look over my code and see if they see any problems?
Thanks for your help. If there is code out there somewhere that already
does this, let me know. I would hate to reinvent the wheel here!
Rick B
----------------------------------------------------------------------
Public Function LogUsage()
DimVarObjectName as String
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tblObjectLoging")
With rs
rs.Edit
rs.AddNew
rs![Object] = VarObjectName
rs![Date] = Date()
rs![UserID] = fOSUserName()
rs.Update
End With
rs.Close
Set rs = Nothing
End Function