Get the sum of Filtered form

Joined
Oct 4, 2012
Messages
1
Reaction score
0
I have the following codes which is show me a filter of data from a table, it works fine. My problem is when i run the query in the form i can't get the total based on the filtering data.

MY question is how i can put a text label shows me the total of the filtering data? i need the code for the label?


Private Sub cmdFilter_Click()

Dim strWhere As String
Dim lngLen As Long

If Not IsNull(Me.txtFilterType) Then
strWhere = strWhere & "([AcctGroupName] Like ""%" & Me.txtFilterType & "%"") AND "
End If
If Not IsNull(Me.txtText16) Then
strWhere = strWhere & "([AccTypeName] Like ""%" & Me.txtText16 & "%"") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)

Me.Filter = strWhere
Me.FilterOn = True

End If
Me.Requery
End Sub
Private Sub cmdReset_Click()

Dim ctl As Control


For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
End Select
Next


Me.FilterOn = False
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Cancel = True
MsgBox "You cannot add new record to the search form.", vbInformation, "Permission denied."
End Sub
Private Sub Form_Open(Cancel As Integer)

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top