Record of Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a database that uses a switchboard after the initial first two
welcome screens close.I am wondering if there is a way to timestamp or record
when the user opens or closes my database so i can monitor the usage?Can this
be done in any one of the two welcome screens or on the switchboard itself?

Thanks
 
Hi,

I have a database that uses a switchboard after the initial first two
welcome screens close.I am wondering if there is a way to timestamp or record
when the user opens or closes my database so i can monitor the usage?Can this
be done in any one of the two welcome screens or on the switchboard itself?

Thanks

Any of these can do it. You'll need a table in your database to record
whatever timestamp information you want; in any of the form's Open
event, open a recordset based on the table and add a record to it.
E.g.

Private Sub frmSwitchboard_Open(Cancel as Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblUseLog", dbOpenDynaset)
rs.AddNew
rs!OpenTime = Now
<maybe set userID or other info>
rs.Update ' write the record
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub

John W. Vinson[MVP]
 
Thanks John,

This is the first time coding for me so i guess from what you have described
if to place this code on one of the welcome screens so it records that event
from that machine.I failed to mention that on each copy of the front DB, one
of the forms has a serial number that identifys the users entrys.To be clear
about this, i need to create a new field on my table such as date/time then
add the code you provided to the welcome screen but at what point in your
code do i enter the users serial number to identify them for the table?
Thanks
 
You need a table like this:
TblUsage
UsageID
DateOfUse
StartTime
EndTime

In the Open event of the first splash screen you need to write today's date
in DateOfUse and the time in StartTime. If the switchboard is the last thing
to close, you need to have code in the Close event to write the time in
EndTime.

A consideration is what to do if the user leaves the database open a couple
of days but during that time his use amounts to what would normally be say 5
times.
 
Hi

I have tried to use this code to to get a smiliar result to what JK was
after. When it runs though (have put it on the form load event), I get a
"user defined type not defined" error. Can anyone give me any pointers as to
where i may be going wrong?

Thanks,

Darren
 
Darren

Any chance you are working with a newer version of Access?

John's code explicitly calls for the DAO objects, but if you haven't set a
reference to, say, DAO 3.6, Access won't know what that is.

--
Good luck

Jeff Boyce
<Access MVP>
 
Hi Jeff

I am using Office XP, but the database I am working on is in 2000 file
format, as that will be the end users version. Do I need to add something
extra to the code to get it to work?

Thanks for any help..

D
 
With any code module open, select Tools | References from the menu bar,
scroll through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, and select it. If you're not going to be
using ADO, uncheck the reference to Microsoft ActiveX Data Objects 2.x
Library

If you have both references, you'll find that you'll need to "disambiguate"
certain declarations, because objects with the same names exist in the 2
models. For example, to ensure that you get a DAO recordset, you'll need to
use Dim rsCurr as DAO.Recordset (to guarantee an ADO recordset, you'd use
Dim rsCurr As ADODB.Recordset)

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)
 
Back
Top