Working with Timesheet Form

Technics

Member
Local time
Today, 05:06
Joined
Aug 9, 2025
Messages
61
Hi all,

Wanted to see if I could get some help with this. As you can see in photo I have date/time totals which provide footer totals. I am using basic math in the form query to get these footer totals. Expressions listed. This is all working correctly giving me all correct totals. The problem, hope photos illustrate, is I get no totals until I close and reopen the form. I am trying to figure out if there is a way for the footer totals to show without having to close and open the form.

Query math:
TotalMinutes: DateDiff('n',[StartTime],[EndTime])
HoursWorked: Round([TotalMinutes]/60,2)
WholeHoursWorked: Int([HoursWorked])
MinutesLeft: [TotalMinutes]-([WholeHoursWorked]*60)
Duration: [WholeHoursWorked] & ":" & Format([MinutesLeft],"00")

2timesheet.jpg
 
Last edited:
can you issue Requery on those 3 Textbox on the Footer, like:

Code:
Private Sub Form_Current()
[TotalMinutesTextbox].Requery
[TotalHoursTextbox].Requery
[TotalHoursMinutesTextbox].Requery
End Sub

on you can use the Form's Current event.
 
can you issue Requery on those 3 Textbox on the Footer, like:

Code:
Private Sub Form_Current()
[TotalMinutesTextbox].Requery
[TotalHoursTextbox].Requery
[TotalHoursMinutesTextbox].Requery
End Sub

on you can use the Form's Current event.
Thanks arnelgp. Requery is what I have been looking at and trying but was not sure exactly how to implement. I tried your code with 3 or 4 variations of textbox names but could not get anything to work. The actual textbox names are SumTotalMinutes, and SumDuration. Even tried it in Forms After Update.
 
The way I did it in my Diabetes DB was to have a sub called CalcTotal and called that on any AfterUpdate event of the controls that would affect the total.
 
Thanks arnelgp. Requery is what I have been looking at and trying but was not sure exactly how to implement. I tried your code with 3 or 4 variations of textbox names but could not get anything to work. The actual textbox names are SumTotalMinutes, and SumDuration. Even tried it in Forms After Update.
Me.SumTotalMinutes.Recalc and Me.SumDuration.Recalc
used in the After Update Event for each of the controls that affect the totals.
 
The way I did it in my Diabetes DB was to have a sub called CalcTotal and called that on any AfterUpdate event of the controls that would affect the total.
Gasman, can you maybe load your vba for the CalcTotal sub.
 
Me.SumTotalMinutes.Recalc and Me.SumDuration.Recalc
used in the After Update Event for each of the controls that affect the totals.
When I try either one of those compile gives me "Message or data member not found" and flags ReCalc in blue. I have been reading about ReCalc. I also tried without the Me and retried Requery using Me because I don't think I had tried using Me with the Requery. Still, could not get anything to work.
 
Everything I read about recalc says I need to sub my total min field., duration field, top line data section as after update event with Me.Recalc. Dosen't work. I did a me.recalc on every field that has anything to do with numbers and totals and still doesn't work?
 
After I typed my statement above and read it back, "anything to do with numbers" I thought except date/time fields so I did a Me.Recalc on them and now it is working. Thanks to everyone for all the ideas, making my head spin and finally helping to make it work.
 

Users who are viewing this thread

Back
Top Bottom