Results 1 to 3 of 3
  1. #1
    leosaumure is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    1

    Time spent on a record

    I've been trying to create a method for recording how long a user spends on a record in a form (and this is the important bit), regardless of whether or not the record is changed by the user.

    What I would like is the form to record the time a record appears on screen to the time the record is no longer on the screen.

    I can't simply use the form's On Dirty event as I still need this data even if the data is not changed. (e.g. the user spent time on the record, but didn't change the record)

    Any help would be appreciated.



    Leo

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    if you want to create a record of this time, use the form current event (end time of previous record would be same as start time for current record) and for the form close event to generate a record for the final record shown.

    perhaps the form would have a public lastID as a long variable and which would be set to 0 in the open event a public starttime date variable

    in the current event, something like

    Code:
    if lastID<>0 then    'append tracking record with lastID, starttime and now()
    lastID=currentID
    starttime=now()
    in the close event

    Code:
    'append tracking record with lastID, starttime and now()

  3. #3
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    If this is a form with navigation controls, you probably want to avoid logging a time below a certain value otherwise you could get lots of records with 1 or 2 second values as user navigates between records. Note also that if your process involves form requery or refresh, the Current event will fire again but you will be on the same record. You will probably have to incorporate whatever event you use with a field on the form so as to know if it's the same record or not. A variable for the ID would have to be declared at the module level and not in the procedure itself. Same goes for the start time. Simply accepting the next execution of the Current event for the form as the end of one and the beginning of another record won't work if requery/refresh happens.
    Last edited by Micron; 02-14-2018 at 07:16 PM. Reason: added info
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-27-2017, 07:09 AM
  2. Replies: 2
    Last Post: 03-02-2017, 02:47 PM
  3. Replies: 1
    Last Post: 01-29-2015, 08:49 PM
  4. Record Time Spent Task
    By rosscortb in forum Access
    Replies: 1
    Last Post: 07-09-2014, 07:55 AM
  5. Time Spent on Activities Report
    By avarusbrightfyre in forum Reports
    Replies: 1
    Last Post: 10-14-2010, 05:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums