Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2008
    Posts
    19

    Red face Unanswered: Read Start and Stop time from timer control (Was "Help needed..urgent")

    Hi all,

    I'm not too good in Access. Currently i developing an access database. It need to have start stop button with timer. I have created the start stop button and the timer. I having difficulity in taking the start time and stop time. Can anyone help me how to get this done. Its urgent. Thank you for your kind help.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    The start button should record the current time / date into a Start field.

    The stop button should record the current time / date into a Stop field.

    You can use the Now() function to give you the current date / time.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Mar 2008
    Posts
    19
    Hi Star,

    The start button should record the time we click the start button to the start txtbox..

    The stop button should record the time we click stop button to the stop txtbox.

    I tried to use the now() function but it only takes the time i click save.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    A classical way of handling this is to use the same button to perform both tasks
    use a static variable to stroe the data, or a module or even global varaible if preferred
    Code:
     ' to be placed inside the <mycommandbutton>.onclick event
    static EventTime as date
    if <mycommandbutton>.caption = "&Start" then ' the timer isn't active
      EventTime=NOW()
      <mycommandbutton>.caption = "S&top"
    else ' the timer was active
       EventTime=now()-EventTime
      'use EventTime Wherever you want to
      <mycommandbutton>.caption = "&Start"
    endif

    you must alwasy make sure the caption on the button is &Start on loading the ofrm.. set it via the forms on load event

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ^ Just don't change them captions though!

    Quote Originally Posted by abie16
    Hi Star,

    The start button should record the time we click the start button to the start txtbox..

    The stop button should record the time we click stop button to the stop txtbox.

    I tried to use the now() function but it only takes the time i click save.
    Actually Now() does give you the date and time, only the formatting of the text boxes makes it look otherwise.

    Me.txtStart = Now() will do it for the start button (in the simple design paradigm) and just format the textbox to something like "d mmm yyyy at h:nn:ss AMPM" (without the quotes) or whatever format you want really.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Mar 2008
    Posts
    19
    Thank you so much StarTrekker Now it works fine.
    now i get the timing automamatically updated to the textbox.

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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