RECORDCOUNT

T

TC

There might be many tables in your database. If you could use recordcount
the way you have tried to, how would VBA know which table you meant?

Anyway, RecordCount is a property of the Recordset object. It is not a
function that returns a value.

Try something like this:

TextLabel2.aption = DCount("*", "MyTable")

(replace MyTable with the name of your table)

There are more efficient ways to get the record count of a table, but that
should get you started.

Also, read-up more on "objects", "methods" and "properties". Those are the
backbone of VBA. Your suggested code, shows that you don't quite understand
those concepts, yet!

HTH,
TC
 
D

DAN

Hello, Im not very familiar with VBA, but I am wonderin
how to use recordcount (Or something else) to return the
number of records that a table has. Currently, here is
what I have:

TextLabel1.Caption = Current Record
TextLabel2.Caption = RecordCount

The currentrecord is returned to the text label, but I
can't get the total number of records to display. Thanks
for the help.
 
G

Guest

You might also try Me.RecordCount if your form is bound
to a table. Be sure to do a MoveLast so VBA is forced to
read all the records and get the count correct.
-Jim
 
C

Cheryl Fischer

Dan,

You could try the following:

Me.RecordsetClone.MoveLast
Me.TextLabel2.Caption = Me.RecordsetClone.RecordCount
 

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