Hi, Tim.
I have a form that filters based on dates provided. Now my question is how
would you find the total number of records of the filtered set?
One way to do it is to read the form's recordset's recordcount in the
Current( ) event to determine if the filter has reset the count back to 1.
Try the following:
' * * * * Start Code * * * *
Private Sub Form_Current()
On Error GoTo ErrHandler
If (Me.Recordset.RecordCount = 1) Then
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
End If
Me!RecCount.Value = Me.Recordset.RecordCount
Exit Sub
ErrHandler:
MsgBox "Error in Form_Current( ) in" & vbCrLf & Me.Name & _
" form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
' * * * * End Code * * * *
.... where RecCount is a text box that displays the form's "filtered" record
count (or total record count when no filter is applied to the form).
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that the first and
best answers are often given to those who have a history of rewarding the
contributors who have taken the time to answer questions correctly.