querie using short time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a query that adds up three fields that contain a short time
format, HoursW1,HoursW2, and HoursW3. For example, an employee worked 8 hours
on each shift a 8:00 would be displayed in each field. The query should
produce a result 24:00, instead my answer is 8:00. My forumula is
=[HoursW1]+[HoursW2]+[HoursW3]
It has to do something with the format, I just don't know what. Anyone have
any clues?
 
First, consider storing the number of hours, not a point in time. 8:00 is
eight o'clock while 8.0 is eight hours. You shouldn't have to add across
fields. This suggests an un-normalized table structure. I would create a
table structure where you sum across records, not fields.

You wouldn't get a result that displays 24:00 since this would be the same
as 12:00 AM.
 
I want it to count time in hours like 36hours 45hours ect

Duane Hookom said:
First, consider storing the number of hours, not a point in time. 8:00 is
eight o'clock while 8.0 is eight hours. You shouldn't have to add across
fields. This suggests an un-normalized table structure. I would create a
table structure where you sum across records, not fields.

You wouldn't get a result that displays 24:00 since this would be the same
as 12:00 AM.

--
Duane Hookom
MS Access MVP
--

oxicottin said:
I am creating a query that adds up three fields that contain a short time
format, HoursW1,HoursW2, and HoursW3. For example, an employee worked 8
hours
on each shift a 8:00 would be displayed in each field. The query should
produce a result 24:00, instead my answer is 8:00. My forumula is
=[HoursW1]+[HoursW2]+[HoursW3]
It has to do something with the format, I just don't know what. Anyone
have
any clues?
 
Then don't store your hours in a datetime field. If your field is datetime
and you don't want to change it, multiply the field by 24 to get the number
of hours.

--
Duane Hookom
MS Access MVP
--

oxicottin said:
I want it to count time in hours like 36hours 45hours ect

Duane Hookom said:
First, consider storing the number of hours, not a point in time. 8:00 is
eight o'clock while 8.0 is eight hours. You shouldn't have to add across
fields. This suggests an un-normalized table structure. I would create a
table structure where you sum across records, not fields.

You wouldn't get a result that displays 24:00 since this would be the
same
as 12:00 AM.

--
Duane Hookom
MS Access MVP
--

oxicottin said:
I am creating a query that adds up three fields that contain a short
time
format, HoursW1,HoursW2, and HoursW3. For example, an employee worked 8
hours
on each shift a 8:00 would be displayed in each field. The query should
produce a result 24:00, instead my answer is 8:00. My forumula is
=[HoursW1]+[HoursW2]+[HoursW3]
It has to do something with the format, I just don't know what. Anyone
have
any clues?
 
Back
Top