Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Filter Record Count

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe - 22 May 2008 23:10 GMT
I have a form that I want a message box to pop up showing the number of
records in the dataset after a filter is applied (Filter By Selection, Filter
Excluding Selection, Remove Filter/Sort, etc).

I've added the following code to the form:

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
MsgBox Me.Recordset.RecordCount
End Sub

Unfortunately, the message box is displaying the number of records in the
form prior to the filter being applied. How can I get a message box to show
the records after the filter is applied?

Example: lets assume that the form is filtered and only 100 or 500 records
are showing. If I right-click and hit Remove Filter/Sort, the message box
pops up and displays "100". I'd like it to display "500", the record count
after the filter change.

I know I'm missing something easy. Thanks in advance for your help!
Bill - 23 May 2008 01:27 GMT
Joe,
I'm not clear where you're invoking the call to Form_ApplyFilter. I have
an application that selects a class of records via a selection list (the
same as clicking on a command button) and the OnClick event sets the
RecordSource filter and issues a Me.Requery. I added your MsgBox
statement immediately after the Me.Requery and get the new record
count without any difficulty. The application is implemented in A2003.
Bill Stanton

>I have a form that I want a message box to pop up showing the number of
> records in the dataset after a filter is applied (Filter By Selection,
[quoted text clipped - 18 lines]
>
> I know I'm missing something easy. Thanks in advance for your help!
Joe - 23 May 2008 03:43 GMT
The Form_ApplyFilter is invoked when I right click on the form and then
select Filter by Selection, Filter Excluding Selection, Remove Filter/Sort,
etc. Each of these essentially results in a filter being applied.

> Joe,
> I'm not clear where you're invoking the call to Form_ApplyFilter. I have
[quoted text clipped - 27 lines]
> >
> > I know I'm missing something easy. Thanks in advance for your help!
Bill - 23 May 2008 03:59 GMT
I assume then that you have some code that essentially looks like

Me.Filter = some_expression
Me.Requery
MsgBox MsgBox Me.Recordset.RecordCount

I don't see that in your Sub, but your "right-click" popup menu
would necessarily take your code on a path that would include
these statements?

Bill Stanton

> The Form_ApplyFilter is invoked when I right click on the form and then
> select Filter by Selection, Filter Excluding Selection, Remove
[quoted text clipped - 36 lines]
>> >
>> > I know I'm missing something easy. Thanks in advance for your help!
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
Jan Baird - 27 May 2008 20:51 GMT
Jan Baird is out of the country until September 20.   Every effort will be
made to respond to messages, but please be patient.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.