Quick Text Box Question

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hi I have a text box and I would like it to coun the
number of records in a specific table. How do I achieve
this?

So I can have something like when they add a record they
can see how many records are in the databse in total.

Many Thanks

James
 
Set the Control Source of your text box to:
=DCount("*", "MyTable")

A Recalc should bring it up to date.
 
So that will always be up to dat when the form is opened
and if a new record is added it will auto update?

Also what do you mean when you say a recalc will bring it
up to date?

Many Thanks

James
 
Yes, Access will calculate the count when the form is opened.

It will also recalculate the count periodically - perhaps when you move
records and other fields need to be recalculated.

You can force Access to recalculate with this code:
Me.Recalc
At worst, you could put that into the Timer event of the form, though it
would be better to avoid that if possible.
 
Back
Top