I would write a query that would group by [day of week] and sum the [time spent] column. Then, when the user puts in a new record, have the query run and perform a DoCmd.Requery to update the screen after the record was entered. Here is the SQL I would use....
SELECT DISTINCTROW [Table1].[dayofweek], Sum([Table1].[timespent]) AS [Sum Of timespent]
GROUP BY [Table1].[dayofweek];
That will give you the results you want. Then I would build your form based on that query that showed the total for each day.
Originally posted by BRIANGAMER
I let a few things out about my form.
I want to do this calculation on the subform that has the above data.
The data is filter by what is in the primary form.
So it kind of like this.
[Name] [Comments] [weekof]
[day of week] [project] [time spent]
I currently have a dsum on the mainform and a refresh button that the user has to click on to display current totals after the subform has been changed.
I want to be able to eliminate the refresh button.
How about instead of a button, you add the code you have behind the refesh button to the 'AfterUpdate' property of the timespent field so when the user enters the timespent, it updates the totals automatically?
But when I do that it puts focus on the first record in the timespent subform. So if you click and change timespent and then click to another record to change another record it jumps to the first record. Kind of annoying.
I would ideally like to do a refresh after I left the subform, but I tried to a procedure from the mainform like on got focus of on dirty. None seem to work. It like I haven't let the mainform.