Solved

How show filtered record count in a textbox on a form

Posted on 2013-06-08
3
2,065 Views
Last Modified: 2013-06-08
I have a textbox on a form which display the total record count in a table.  But I also want to have a textbox on the form that shows the filtered record count on the form.

Here's my default value code for the first textbox.

=DCount("[ID]","tblImportRecords")

But what would the code be for the filtered record count?

Also, would it be in the afterupdate event of the form itself?
0
Comment
Question by:SteveL13
3 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39231820
=DCount("[ID]","tblImportRecords",Me.Filter)

<<Also, would it be in the afterupdate event of the form itself? >>

Not sure what you mean or are looking to do.

Jim.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39231821
To base it on the form's recordset, try this in the Current Event of your form:


Private Sub Form_Current()
      dim rs as DAO.Recordset
      set rs = Me.RecordsetClone
       if rs.RecordCount > 0 then
           rs.MoveLast
       end if
       Me.MyTextboxName = rs.Recordcount
End Sub

Open in new window

0
 
LVL 77

Expert Comment

by:peter57r
ID: 39231823
In the Form.ApplyFilter event procedure

Me.yourtextboxname = Me.RecordsetClone.RecordCount
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question