Adding up time for currency

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    Adding up time for currency

    i have a form that i don't know how to add up time to get a currency value is there away to do this this is what my form has in it

    Fields:
    1 - Qty
    2 - Description
    3 - Time Started (Defaulted to Now(),)
    4 - Time Ended
    5 - Rate Price
    6 - Amount Due

    i want to add up when time started with Time ended times that by the rate to get the amount. how would i do this?

    Lee123
  • cori25
    New Member
    • Oct 2007
    • 83

    #2
    In the Amount Due field on your form, right click and go to properties. Go to Row Source Type and select Table/Query, in the Row Souce(Right below), select the table/query that will have all the below fields so that you can add the below.

    You will first have to determine the amount of time spent by doing this'

    Duration:([Time Ended]-[Time Started])*24

    Once you have populated this field, then do this'

    Currency:[Duration]*[Rate Price]

    Comment

    • lee123
      Contributor
      • Feb 2007
      • 556

      #3
      thank you but how do you format the time in hours, because i thought in the query table you could right click the field and choose a format but i guess you can't.

      Lee123

      Comment

      • cori25
        New Member
        • Oct 2007
        • 83

        #4
        If you need to format the time, this is what you would do for both the start and end times in a query:

        Time:Format([Start Time], "hh:mm:ss")

        If you need this formatted in the form then just go to Format Cells

        Comment

        • lee123
          Contributor
          • Feb 2007
          • 556

          #5
          now that i have looked at what you have suggested i have noticed that the when you do this

          Duration * Rate price

          it's not adding up right. Example if i had a time like 2:30 pm and ended at 5:30 pm that would be 3 hours and the amount due would say $75.00 at the rate price of $25.00

          using what i have explained in the example above the amount due comes out to be $380.73 on the calculations that's way too much. in my fields in the query table i have made a field named "Hours" and another one name "Amount Due" and in my hours field i have placed you code

          Time Ended -Time Started * 24

          in my amount due i have this

          Hours * Rate Price

          i don't know if i have done this right. maybe that's why the wierd figures.

          Lee123

          Comment

          • cori25
            New Member
            • Oct 2007
            • 83

            #6
            Duration: ([Time Ended]-[Time Started])*24

            Amount: [Duration]*[Rate]

            This works perfectly for me.....you have to type it the same as shown with the quotations and brackets.

            If you still have no luck....take a look at what the fields are pulling into access as(text, numeric, date/time, etc...)

            The time should be in the atble as a Date/Time field and the Rate should be a currency field

            Comment

            • lee123
              Contributor
              • Feb 2007
              • 556

              #7
              i see what i did i for got to add the parenthese in there, my bad thanks for you help (Cori25)

              lee123

              Comment

              Working...