I can't get my code to SUM correctly. I'm getting #Error in the textbox.
I have a Mainform with a textbox referencing another textbox(performing the SUM function) on a subform. I think the problem is this subform is based off a query and the field I am trying to SUM is formatted.
Here is some detailed info:
Query code:
HTML Code:
SELECT [Work Hours].Employee, [Work Hours].[Date Worked], [Work Hours].[Work Type], [Work Hours].[Work Task], FormatMinutesAsHMM([MinutesWorked]) AS Hours, [Work Hours].[Work Descripton]
FROM [Work Hours] LEFT JOIN [Employees Extended] ON [Work Hours].Employee = [Employees Extended].ID
WHERE ((([Work Hours].[Date Worked])=Date()) AND (([Employees Extended].[User Login])=[Forms]![frmLogin]![LoginName]));
The field in question is: FormatMinutesAsHMM([MinutesWorked]) AS Hours
Subform textbox(name is totalhours) =FormatMinutesAsHMM(Sum([Hours]))
Mainform textbox =[NavigationSubform].[Form]![totalhours]
The table "Work Hours", field name "MinutesWorked", has data entered in as minutes(15, 30, 90, etc)
My FormatMinutesAsHMM module is converting those minutes into h:nn
The Subform based on the query is in datasheet view for the users so that "totalhours" textbox is in the footer.
How can I SUM this field and show it on my Mainform? Why is my current configuration displaying "#Error" instead of the SUM of the data?