Solved

How show filtered record count in a textbox on a form

Posted on 2013-06-08
3
2,016 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Export to flat file from Access 2003, not using saved spec 9 21
Reference theme colors in VBA 4 23
Calculation in Access 5 23
Should I keep recordsets open? 3 21
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now