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
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