Filtered Record Count on a Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MOCaseA
    New Member
    • Aug 2010
    • 34

    #1

    Filtered Record Count on a Form

    Hello,

    I am trying to generate a text field showing the number of forms available fo viewing after I use a filtering system to cut down the number of applicable records (i.e. I filter down from 2K+ to 20 records) however I can't seem to figure out anything on how to do this. I'm not ever sure what type of field/text box/combo box or whatever to use for this. I'm completely lost and would appreciate any help I can get. Thanks. Attached is a screen shot of the form and the code used on this form for filtering. On the lower left of the Screen shot is the record navigational tool with numerical reference (1 of 2124, the record was sanitized for privacy purposes). When filtered the number of available records of course drops. I'd like these numbers displayed on the form as when this is finalized the user won't have access to the record navigational tool. Here is the code I used for filtering:

    Code:
    Private Sub CAR_AfterUpdate()
        SetFilter
    End Sub
    Private Sub Date_AfterUpdate()
        SetFilter
    End Sub
    Private Sub System_AfterUpdate()
        SetFilter
    End Sub
    Private Sub SaNiTiZeD_AfterUpdate()
        SetFilter
    End Sub
    Private Sub System_POC_AfterUpdate()
        SetFilter
    End Sub
    Private Sub SetFilter()
        Dim FilterCriteria As String
        If CAR & "" <> "" Then FilterCriteria = FilterCriteria & " AND [CAR]='" & CAR & "'"
        If Date & "" <> "" Then FilterCriteria = FilterCriteria & " AND [Date]='" & Date & "'"
        If System & "" <> "" Then FilterCriteria = FilterCriteria & " AND [System]='" & System & "'"
        If SaNiTiZeD & "" <> "" Then FilterCriteria = FilterCriteria & " AND [SaNiTiZeD]='" & SaNiTiZeD & "'"
        If System_POC & "" <> "" Then FilterCriteria = FilterCriteria & " AND [System POC]='" & System_POC & "'"
        If FilterCriteria = "" Then
                Me.FilterOn = False
        Else
            FilterCriteria = Mid(FilterCriteria, 6) 'REMOVE THE LEADING " AND "
            Me.Filter = FilterCriteria
            Me.FilterOn = True
        End If
    End Sub
    It is a little dirty but it works and does exactly what I want it to do.

    Any help would be appreciated.
    Attached Files
  • beacon
    Contributor
    • Aug 2007
    • 579

    #2
    Hi MOCaseA,

    So you're just trying to mimic the navigation buttons and the selected record/total number of records, right?

    If so, there's a great article on databasedev.com . Here's the link: http://www.databasedev.co.uk/navigat...ord-count.html

    Hope this helps...

    beacon

    Comment

    • MOCaseA
      New Member
      • Aug 2010
      • 34

      #3
      That was exactly what I was looking for. Thank you!

      Comment

      • beacon
        Contributor
        • Aug 2007
        • 579

        #4
        Happy to help! =)

        Comment

        Working...