How show filtered record count in a textbox on a form

Posted on 2013-06-08
Medium Priority
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.


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

Also, would it be in the afterupdate event of the form itself?
Question by:SteveL13
LVL 59

Accepted Solution

Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 total points
ID: 39231820

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

Not sure what you mean or are looking to do.

LVL 61

Expert Comment

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
       end if
       Me.MyTextboxName = rs.Recordcount
End Sub

Open in new window

LVL 77

Expert Comment

ID: 39231823
In the Form.ApplyFilter event procedure

Me.yourtextboxname = Me.RecordsetClone.RecordCount

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
What to do if a split doesn't fit? Or a bunch of invoice lines must be rounded while the sum must match a total? It takes a little, but - when done - it is extremely easy to implement.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

624 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