record count help
Greetings,
I've got to do a count of all the records in a search.
Right now I've used an array to get the results but how can I also get a count of the records found. Example: if I search for the records that contain the REV letter "A" and I get a return showing 24 records, I want to have a msgbox the shows the number of records found is 24.
Here is my search code:
Private Sub TogFilter_Click()
Dim strFilt(0 To 10) As String
Dim aryIdx As Integer
Dim FiltStr As String
If TogFilter.Value = -1 Then
If cboDwgNo.Value <> "" Then strFilt(0) = "[DwgNo] = '" & cboDwgNo.Value & "'"
If cboLineNo.Value <> "" Then strFilt(1) = "[LineNo] = '" & cboLineNo.Value & "'"
If cboDwgType.Value <> "" Then strFilt(2) = "[DwgType] = '" & cboDwgType.Value & "'"
If cboPIDNo.Value <> "" Then strFilt(3) = "[PIDNo] = '" & cboPIDNo.Value & "'"
If cboPipeSpec.Value <> "" Then strFilt(4) = "[PipeSpec] = '" & cboPipeSpec.Value & "'"
If cboProjNo.Value <> "" Then strFilt(5) = "[ProjNo] = '" & cboProjNo.Value & "'"
If cboRev.Value <> "" Then strFilt(6) = "[Rev] = '" & cboRev.Value & "'"
If cboModule.Value <> "" Then strFilt(7) = "[Module] = '" & cboModule.Value & "'"
If cboArea.Value <> "" Then strFilt(9) = "[Area] = '" & cboArea.Value & "'"
If cboStress.Value <> "" Then strFilt(9) = "[StressRel] = '" & cboStress.Value & "'"
If cboTracing.Value <> "" Then strFilt(10) = "[tracing] = '" & cboTracing.Value & "'"
For aryIdx = LBound(strFilt) To UBound(strFilt)
If strFilt(aryIdx) <> "" Then
If FiltStr <> "" Then
FiltStr = FiltStr & " and " & strFilt(aryIdx)
Else
FiltStr = strFilt(aryIdx)
End If
End If
Next aryIdx
End If
If FiltStr = "" Then FiltStr = "[DwgNo] <> ''"
FiltStr = "(" & FiltStr & ")"
Me.Filter = FiltStr
DoCmd.ApplyFilter , FiltStr
Me.Refresh
End Sub
Thanks
|