I have a field that calculates the total ‘amount’ at the footer of my form, however as the number of records increases the longer this is taking to calculate. As a result I would like to move this into my search code.
Currently the sum fields is:- =Sum([Amount])
My search code is:-
Private Sub btnSearch_Click()
' Update the record source
Form_Search_Form.RecordSource = "SELECT * FROM qryUnionTables " & BuildFilter
Form_Search_Form.Caption = "Your Search Results"
Me.txtSumSearch = (Sum([Amount]))
End Sub
As can be seen I have created an unbound text field called and txtSumSearch and tried to add it to my search button, so that it only calculates totals of the search criteria and not the full record set. However this does not work, and nor do other combinations I have tried.
I am sure it is very easy and I am going to be kicking myself, but ..............
Currently the sum fields is:- =Sum([Amount])
My search code is:-
Private Sub btnSearch_Click()
' Update the record source
Form_Search_Form.RecordSource = "SELECT * FROM qryUnionTables " & BuildFilter
Form_Search_Form.Caption = "Your Search Results"
Me.txtSumSearch = (Sum([Amount]))
End Sub
As can be seen I have created an unbound text field called and txtSumSearch and tried to add it to my search button, so that it only calculates totals of the search criteria and not the full record set. However this does not work, and nor do other combinations I have tried.
I am sure it is very easy and I am going to be kicking myself, but ..............