Results 1 to 7 of 7
  1. #1
    rockcliff15 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    7

    Duration field NOT time

    Hi guys,

    this may be a really basic question but what is the best way to record durations, not time?

    I want to have a table that records charging data such as below:

    startDate
    startTime Duration


    (hh:mm:ss)
    15/04/2012 12:00:00 13:00:00

    In this example you can see we started charging the device at 12pm on 15/04/2012 for 13 hours, from this I will be working out the endDate/time using dateAdd etc.

    Do I set the duration field up as a dateTime and if so how do I avoid the DB thinking that the field is a time and not a duration, meaning that the endDate would be 1pm on the 15/04/2012 instead of the correct 1am on the 16/04/2012?
    Cheers

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If I were you I would use a LongInteger field and record the seconds of duration which can then be converted to anything you want.

  3. #3
    rockcliff15 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    7
    Quote Originally Posted by RuralGuy View Post
    If I were you I would use a LongInteger field and record the seconds of duration which can then be converted to anything you want.
    Thanks for the suggestion, can you think of any other way as I will also be producing a form as a front end to this table and this way the users will have to convert each duration into seconds themselves.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have them enter the value any way you want and *you* do the conversion in code before storing.

  5. #5
    rockcliff15 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    7
    Quote Originally Posted by RuralGuy View Post
    Have them enter the value any way you want and *you* do the conversion in code before storing.
    Can this be done using a split form?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I've never used a split form. If the user already has the duration value in hh:mm:ss then go ahead and store it in a text field that way.

  7. #7
    rockcliff15 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2012
    Posts
    7
    Quote Originally Posted by RuralGuy View Post
    I've never used a split form. If the user already has the duration value in hh:mm:ss then go ahead and store it in a text field that way.
    Thanks I'll do that and when I need to display the dateCompleted I'll use a series of substrings and dateAdd.

    Cheers

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

Similar Threads

  1. Count one event regardless of duration
    By jbr87 in forum Queries
    Replies: 8
    Last Post: 03-05-2012, 08:54 PM
  2. Replies: 1
    Last Post: 06-14-2011, 05:23 PM
  3. Replies: 1
    Last Post: 11-12-2010, 01:16 AM
  4. How to calculate duration in hours & minutes
    By joypanattil in forum Access
    Replies: 0
    Last Post: 11-25-2009, 04:49 AM
  5. date/time field
    By James890 in forum Database Design
    Replies: 1
    Last Post: 04-18-2007, 07:51 AM

Tags for this Thread

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