Only sum search results

jomuir

Registered User.
Local time
Today, 13:38
Joined
Feb 13, 2007
Messages
154
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 ..............
 
Still having problems getting this to work (I have been on holiday for a while :) )but back looking at this functionality - anyone got any suggestions?
 

Users who are viewing this thread

Back
Top Bottom