# Thread: Problem with Calculatons?

1. Registered User
Join Date
Nov 2005
Location
Live Oak, California
Posts
32

## Unanswered: Problem with Calculatons?

I have this query with the following fields:

Visit Date – pulled from table

Start Time – pulled from table (short time)

Stop Time – pulled from table (short time)

Hours - HOURS: [STOP TIME]-[START TIME] (Short Time)

Rate - RATE: [HOURS]*Switch([CLT3]="X",[HOURS HR]*1.5,[CLT2]="X",[hours hr]*1.25,[clt2]="",[hours hr],[CLT3]="",[HOURS HR]) (currency)

CLT2 - (text)

CLT3 - (text)

Hours HR – pulled from table

My ultimate goal is to have the rate and number of hours. The rate=hours hr*hours. When I do this I get the following in the rate column \$1.17 for 3 ½ hours. It should read \$28.00.

2. Registered User
Join Date
Feb 2004
Location
Chicago, IL
Posts
1,312
The problem is with your Hours calculation. The way time is stored, the number you are expecting is going to be very small. What you need to do is use the DateDiff function. So something like:

Hours : DateDiff("H",StopTime,StartTime)

That will give you the number of hours between the two times.

Do you ever have times that span 12 midnight? That situation will make this calculation fail.
Last edited by DCKunkle; 02-10-06 at 15:55.

3. Registered User
Join Date
Jun 2004
Posts
50
Then you do minutes*60

#### Posting Permissions

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