Count filtered records

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

matt weyland

try this

msgbox = cmbFilter.listcount

Matt Weyland
Data Analyst
Stratis Health
(e-mail address removed)
 
U

Unnur U

This does not work since I am not counting within a
combobox or listbox.
Thanks Matt.
 
M

Marshall Barton

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
 
U

Unnur U

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

Top