I am trying to have a sum of a field in a form with a textbox, and would inlcude a total for the current record and all prior for that field. In the following Log ID is the Primary Key, Hours trained is the Field to sum, Totals Hrs is the field for the Total, TTLOG is the table, and the Form is also TTLOG. I would like to call this on lost focus Event. I have included what I have based on the example referenced and others work. I am not sure how to call the total to the Text box, or if I need to create a module, and wasn't sure what idValue was either ? any help would be appreciated...
Private Function frmRunSum(curForm As Form, Log_ID As String, idValue, sumField As String)
If Not IsNull(Me!Log_ID) Then
UniqueNamePerForm = frmRunSum(Me, "Log_ID", Me!Log_ID, "Hours_Trained")
[Total Hrs] = ([Hours Trained])
End If
End Function
Private Function frmRunSum(curForm As Form, Log_ID As String, idValue, sumField As String)
If Not IsNull(Me!Log_ID) Then
UniqueNamePerForm = frmRunSum(Me, "Log_ID", Me!Log_ID, "Hours_Trained")
[Total Hrs] = ([Hours Trained])
End If
End Function