Results 1 to 13 of 13

Thread: time record

  1. #1
    Join Date
    Mar 2009
    Posts
    27

    Unanswered: time record

    hi,

    i have a table in which there a field which captures the system time everytime a record is added. i want the difference in time calculated and saved in a different field everytime a new record is entered.

    Rajat

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    So where is the problem ? (Hint: DateAdd and AfterUpdate)

    Have a nice day!

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by orajat
    hi,

    i have a table in which there a field which captures the system time everytime a record is added. i want the difference in time calculated and saved in a different field everytime a new record is entered.

    Rajat
    Difference in what times?Actually DateDiff() is probably the function you need.

    If you're talking about the difference in the time the new record you're entering and the last record entered, you'd need to use DMax() to find that last Date/Time and then use DateDiff() to calculated the the Difference.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Mar 2009
    Posts
    27
    i think i missed out one important detail....if there are multiple users adding records, then the time diff should be calculated for each and every user in isolation, i mean the time diff should be equal to new record's time minus the old record's time entered by "that user" only.....and this should keep hapenning for every user logging records in the table...

    Rajat

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    And do you have a field in your record that signifies which user is entering a given record?
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  6. #6
    Join Date
    Mar 2009
    Posts
    27
    yes that correct...

  7. #7
    Join Date
    Mar 2009
    Posts
    27
    missinglinq.....any luck on this one ?????

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Just to modify what MissingLinq said:

    You'd need to use DMax() to find that last Date/Time for the current user and then use DateDiff() to calculate the difference.
    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

  9. #9
    Join Date
    Mar 2009
    Posts
    27
    tried but did'nt work.....am attaching the db file, i need that data to be captured in the TimeTracker Table through the TimeTracker form
    Attached Files Attached Files

  10. #10
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    There is NO reason to store the difference. Store the user and time of entry for each record and display the time difference when you do the query.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  11. #11
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    What Bill said!

    There are times when it's acceptable to store calculated values, such as when one or more factors change frequently, such as the cost of an item or the sales/VAT tax. But when nothing can possibly change, such as the difference between two time/dates, you re-calculate it whenever it's needed, you don't store it!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  12. #12
    Join Date
    Mar 2009
    Posts
    27
    that makes sense...but how do i create a query with dmax and datediff ?

  13. #13
    Join Date
    Mar 2009
    Posts
    27
    hi,

    can anyone help me on this ?

Posting Permissions

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