half hour payment problem

  • Thread starter LB via AccessMonster.com
  • Start date
L

LB via AccessMonster.com

I design database to calculate working hours Total=(From-To)*(PayRate);Total
hours is wroking properly.
How can i change "PayAmount" formula to calculate Half hour correctly

1.This fomula calculate difference between start date and End Date
Total: Format([From]-1-[To],"Short Time")

2.this formula calculate Payment Amount
PayAmount: Round(CCur(Nz(DateDiff("n",[From],[To])*[PayRate]/60,0)),2)

8:00 * 6.25= 50 (Correct)

8:30 * 6.25=53.12(wrong)

8.30 * 625= 51.87 (Correct)

I ifound this formula from this forum but i still have same problem,when
total hours is 1.30 or 4.30 querie give wrong pay amount
Expr1: DateDiff("n",#00:00:00#,[Total])/60*6.25

ms Access 2003
 
G

Guest

LB via AccessMonster.com said:
I design database to calculate working hours Total=(From-To)*(PayRate);Total
hours is wroking properly.
How can i change "PayAmount" formula to calculate Half hour correctly

1.This fomula calculate difference between start date and End Date
Total: Format([From]-1-[To],"Short Time")

2.this formula calculate Payment Amount
PayAmount: Round(CCur(Nz(DateDiff("n",[From],[To])*[PayRate]/60,0)),2)

8:00 * 6.25= 50 (Correct)

8:30 * 6.25=53.12(wrong)

8.30 * 625= 51.87 (Correct)

I ifound this formula from this forum but i still have same problem,when
total hours is 1.30 or 4.30 querie give wrong pay amount
Expr1: DateDiff("n",#00:00:00#,[Total])/60*6.25

ms Access 2003

The formula is giving you the correct amounts.

The problem is *how* you are writing the difference in time.

When you use the colon like this > 8:30, it means 8 hours plus 30 minutes,
which is 8 hours plus 30/60 of an hour, which equals 8.5 hours. 8.5 * 6.25 =
53.12 (correct)


When you use a decimal, as in 8.3, it means 8 hours plus 3 tenths (3/10) of
a hour, which is 18 minutes. So 8:18 is equal to 8.3.
8.3 * 6.25 = 51.87 (correct)


And 8:00 is 8 hours and zero minutes, so 8.0 * 6.25 = 50.00 (correct)


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top