Count filtered records

  • Thread starter Thread starter Unnur U
  • Start date Start date
U

Unnur U

Is it possible to count filtered records when filtering by
VBA.

I have following code:

Private Sub cmbFilter_Click()
Me.Filter = "ID > 7000"
Me.FilterOn = True
End Sub

I need to display number of visible records in a Message
Box after pushing the button.

How can this be done?

Thanks
Unnur.
 
try this

msgbox = cmbFilter.listcount

Matt Weyland
Data Analyst
Stratis Health
(e-mail address removed)
 
This does not work since I am not counting within a
combobox or listbox.
Thanks Matt.
 
Unnur said:
Is it possible to count filtered records when filtering by
VBA.

I have following code:

Private Sub cmbFilter_Click()
Me.Filter = "ID > 7000"
Me.FilterOn = True
End Sub

I need to display number of visible records in a Message
Box after pushing the button.

Add code like:

With Me.RecordsetClone
If .RecordCount > 0 Then .MoveLast
lngRCnt = .RecordCount
End With
 
This was lovely.
Thank you Marsh
Unnur
-----Original Message-----


Add code like:

With Me.RecordsetClone
If .RecordCount > 0 Then .MoveLast
lngRCnt = .RecordCount
End With
 

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

Similar Threads

Filtering and Removing Filter based on a combo box 4
Coding 3
filter on dates 2
Runtime error 2001 2
Filtered field goes blank 2
Creating a filter using VBA 5
Multiple Filter Criteria 4
Option Button as Filter 3

Back
Top