Results 1 to 7 of 7
  1. #1
    hellojosie is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    16

    Calculation for time x hours in table


    Hi,

    I greatly appreciate any help in advance!

    I need to calculate in the tbleJobs table, the amount of the jobs total amount and place the result in the JobsTotalAmount field.

    This has to be a manual calculation. Not an on event calculation.

    Data is coming from two table:

    tblLimos has the hourly rate.

    tblJobs has the start time, the finish time and the total amount field.

    Thanks for looking!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    Why are you trying to save calculated results? A principal of relational database is enter raw data, do calcs in reports. Tables hold data, queries manipulate it. Do calcs in queries or in textboxes on form or report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    hellojosie is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    16
    Thank you June7 for your reply.

    I agree with you.

    I am a student studying access and it is a requirement for an assignment that I set up this calc in a table.

    Is it possible?

    I did set up a query that shows:

    JobsTotalAmount: DateDiff("n" [JobStartTime],[JobReturnTime])*[LimoHourlyRate]

    This formula is entered in the fieild, field.

    But this just returns a pop up box for a parameter query that says "JobStartTime".

    Thanks again for replying I have been working on this for hours and hours of the last few days.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    Access2007 does not allow calculations directly in table (new feature in Access2010). Must do in query or textbox on form. Then VBA code behind form can save the calculated result to table field.

    I assume the comma missing in front of JobStartTime is a post typo because Access would error on that syntax flaw.

    The prompt is because Access can't find a field called JobStartTime. Show the complete query SQL statement for analysis.

    The parameter for hours is "hh", not "n" which is for minutes.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    hellojosie is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    16
    This is the exact formula now and I don't know why but it is displaying #func! in the JobsTotalAmount field.

    JobsTotalAmount: DateDiff("hh",[JobStartTime],[JobReturnTime])*[LimoHourlyRate]

    Data fields in the tables are

    JobStartTime & JobReturnTime- Date/Time, Short Time
    LimoHourlyRate-Number
    JobsTotalAmount-Number

    Thankyou again!

  6. #6
    hellojosie is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2011
    Posts
    16
    I ended up entering this formula into a query and it works!!
    JobsTotalAmount: DateDiff("h",[JobStartTime],[JobReturnTime])*[LimoHourlyRate]
    Thanks again for your help June7

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,598
    Microsoft article said the parameter for hours was 'hh' but I guess it is really 'h'. Not something I have used much. Glad you got it working.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Calculating Overtime hours from Time entries
    By weshader in forum Programming
    Replies: 3
    Last Post: 11-13-2011, 01:08 AM
  2. Can hours be sum?
    By newtoAccess in forum Queries
    Replies: 9
    Last Post: 10-10-2011, 11:01 PM
  3. Hours and OT Hours
    By Ruthers456 in forum Forms
    Replies: 2
    Last Post: 06-27-2011, 10:09 AM
  4. Automatic Calculation in table
    By musicalogist in forum Access
    Replies: 4
    Last Post: 04-22-2010, 11:52 AM
  5. Replies: 7
    Last Post: 12-14-2009, 04:49 PM

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