Results 1 to 11 of 11
  1. #1
    Join Date
    Mar 2004
    Posts
    38

    Unanswered: Setting up a timer

    I wanna set up a timer to know how much time a user spends on a certain form. I wanna do it by getting the absolut (date+exact time) date the user opens the form and compare it to the absolut date the user leaves the form. What data type should I use, and what functions return the absolut date (Date only returns the date, not the absolut date)?

    Thanx ahead

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: Setting up a timer

    Originally posted by dd_plus
    I wanna set up a timer to know how much time a user spends on a certain form. I wanna do it by getting the absolut (date+exact time) date the user opens the form and compare it to the absolut date the user leaves the form. What data type should I use, and what functions return the absolut date (Date only returns the date, not the absolut date)?

    Thanx ahead
    Type: Date

    System function: Now


    Dim MyDate as Date

    MyDate=Now

    What do you mean by "absolute date"? The only date available on a pc is the date and time from the OS ...

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    you can define tow globals glb_SecStart and glb_secEnd

    When the user enters your form let

    glb_SecStart = Timer

    When he gets out of your form let
    glb_SecEnd = Timer

    The difference is the time he spent on your Form in secounds

  4. #4
    Join Date
    Mar 2004
    Posts
    52
    Hi,

    Im kind of new to ACCESS, so where would I type the code

    glb_SecStart = Timer

    and

    glb_SecEnd = Timer

  5. #5
    Join Date
    Mar 2004
    Posts
    38
    Originally posted by hammbakka
    you can define tow globals glb_SecStart and glb_secEnd

    When the user enters your form let

    glb_SecStart = Timer

    When he gets out of your form let
    glb_SecEnd = Timer

    The difference is the time he spent on your Form in secounds
    Thanx alot!
    Those are longints right?

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by hali99
    Hi,

    Im kind of new to ACCESS, so where would I type the code

    glb_SecStart = Timer

    and

    glb_SecEnd = Timer
    Well since Hammy identified these variables as globals you could put them in a module, or a form (at the top) ...

  7. #7
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by dd_plus
    Thanx alot!
    Those are longints right?
    Nope!

    See:

    Timer Function


    Returns a Single representing the number of seconds elapsed since midnight.

    Syntax

    Timer

    Remarks

    In Microsoft Windows the Timer function returns fractional portions of a second. On the Macintosh, timer resolution is one second.


    NOTE: There is a draw back to this method that Hammbakka gave you ... I'll leave it for you to discover ...

  8. #8
    Join Date
    Mar 2004
    Posts
    52
    Ok, where would I type your code????

  9. #9
    Join Date
    Mar 2004
    Location
    Nashville, TN
    Posts
    557
    Hali you would put it in a module, or at the top of a form's code. (it is a global function).

    Alt F11 brings up the VBA code window that you will need to insert the code.

    Hope this helps,
    J

    Originally posted by hali99
    Ok, where would I type your code????
    Have you ever thought about thinking on purpose?

    Jarvis Stubblefield
    Patriot Designs
    Web/Database Development and Consulting
    The-Patriot.net by Patriot Designs

  10. #10
    Join Date
    Mar 2004
    Posts
    38

    Cool

    Originally posted by M Owen
    Nope!

    See:

    Timer Function


    Returns a Single representing the number of seconds elapsed since midnight.

    Syntax

    Timer

    Remarks

    In Microsoft Windows the Timer function returns fractional portions of a second. On the Macintosh, timer resolution is one second.


    NOTE: There is a draw back to this method that Hammbakka gave you ... I'll leave it for you to discover ...
    The problem with working right before midnight until after midnight DOH... Dont patronize dude

  11. #11
    Join Date
    Mar 2004
    Posts
    52
    Originally posted by JSThePatriot
    Hali you would put it in a module, or at the top of a form's code. (it is a global function).

    Alt F11 brings up the VBA code window that you will need to insert the code.

    Hope this helps,
    J
    Thnaks JS, Il give it a try.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •