Calculated fields processing on another calculated field

G

Guest

I can understand the frustration of everybody wanted to store calculated fields in their tables. I have a problem also I have the result of a calculated field of time difference. [TimeEnd]-[TimeStart] results appear in Texbox [TimeWorked]. This gives me the time worked for on record (one day). How do I use the result of this textbox in another calculated field to give me [TotalTime]. In othe words a calculation on a calculated field. Other that saving my first calculated field I dont seem to be able to accomplish this. ANYBODY CAN HELP?????
 
J

Joe Fallon

John,
Sometimes you have to know when to "break" the rules.

I consider Durations (Stop Time - Start Time) to be of such critical
importance that I *do* store them in the table rather than re-calculate them
each time. I built a Payroll applicaiton that ran for 5 years in a facility
of 500 employees who had to swipe cards in time clocks. I computed
everything in hours and tenths of hours. So 8.3 was 8 hours and 3 tenths of
an hour. Having a field of HoursWorked made summing things very simple.
--
Joe Fallon
Access MVP



John said:
I can understand the frustration of everybody wanted to store calculated
fields in their tables. I have a problem also I have the result of a
calculated field of time difference. [TimeEnd]-[TimeStart] results appear in
Texbox [TimeWorked]. This gives me the time worked for on record (one day).
How do I use the result of this textbox in another calculated field to give
me [TotalTime]. In othe words a calculation on a calculated field. Other
that saving my first calculated field I dont seem to be able to accomplish
this. ANYBODY CAN HELP?????
 
J

John Vinson

I can understand the frustration of everybody wanted to store calculated fields in their tables. I have a problem also I have the result of a calculated field of time difference. [TimeEnd]-[TimeStart] results appear in Texbox [TimeWorked]. This gives me the time worked for on record (one day). How do I use the result of this textbox in another calculated field to give me [TotalTime]. In othe words a calculation on a calculated field. Other that saving my first calculated field I dont seem to be able to accomplish this. ANYBODY CAN HELP?????

Do the calculation in the Query upon which the form is based, rather
than in the Form. I.e. put

TimeWorked: DateDiff("n", [TimeStart], [TimeEnd])

to calculate the number of minutes worked. Don't subtract times; doing
so will give a Date/Time value which isn't really a duration, it's a
point in time on December 30, 1899.

In the Form, bind the textbox txtTimeWorked to the field TimeWorked;
in the form's Footer put another textbox txtTotalTime with control
source

=Sum([TimeWorked])

or (to display as hours and minutes)

Sum([TimeWorked]) \ 60 & Format([TimeWorked] MOD 60, ":00")
 

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