Quick Text Box Question

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
 
A

Allen Browne

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

A Recalc should bring it up to date.
 
J

James

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
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top