Solved

How show filtered record count in a textbox on a form

Posted on 2013-06-08
3
1,931 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

744 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

15 Experts available now in Live!

Get 1:1 Help Now