Jaffa said:
I'm sorry, I didn't follow that...
In the Hours Worked table, the fields such as MonS, MonF, etc are Date/Time
format
I haven't set it to anything else in the query...
You probably have a date in the field instead of just a time and are
calculating it over multiple days.
Craig
Thank you Philip, Steve and Craig. I really appreciate you taking the time to
look at this for me and for your explanations.
[quoted text clipped - 39 lines]
Can someone please help me with this!
Thanks!
A bit more explanation is needed here. Access stores Date/Time fields
as a "real" number, so it has an integral part and a fractional part.
The integral part represents the day, and the fraction represents the
time. (I don't believe it's easy to see this directly, as Access
protects the integrity of the values, making sure you can't have 30th
Feb, for example). You have to use the Date/Time functions (see the
Expression Builder, or Help) to manipulate these values.
When you enter a value into a Date/Time field, Access converts what you
enter into its Date/Time format, using separators (like / -
to
"parse" the value to obtain a valid date number.
Once you have a valid date you can display it in various ways. If you
are only interested in Times, you can set the format to one of the Time
options and you're effectively hiding the date part of the value. The
obverse is true if you format only as a date - you're hiding the Time
(fraction) part.
If you perform arithmetic on dates, you can end up with a general number
(long, which is a real number) - this is what you need if you're going
to calculate payroll, for example. You can display this number in
various ways: as a plain number, or you can use the "format" function to
choose how to display it (as a string). I could only find the full list
of "custom format" characters in the VB Help, under "Format Property -
Date/Time Data Type" (Acc 2003).
Incidentally, I didn't pick up my mistake about 7.75 being equivalent to
7:45 - it isn't, as you'll see from the above. Sorry about that - it
just goes to show how smart the real experts are, because they don't
make this sort of mistake!
Try typing this into an empty "Field" box in the query builder:
Tea-Time: =format(0.75, "hh:mm").
You should see the value "18:00" when you run it, which is
three-quarters through the day. You get the same output if you change
the 0.75 to 99.75 or any other value ending .75.
Does that get you where you need to be?
Phil