Count # of records in a table..

S

Steve P

Hi, I just need a simple chunk of code that returns the total number of
records on a given table without any filtering...sounds easy enough i
thought...lol.
 
J

John Spencer

Simplest thing is

DCount("*","NameOfYourTable")
that works for local tables and linked tables.

If the tables are not linked but are in the database, this is probably the
fastest way to get a count.

CurrentDB().TableDefs("NameOfYourTable").RecordCount

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
J

John W. Vinson

Hi, I just need a simple chunk of code that returns the total number of
records on a given table without any filtering...sounds easy enough i
thought...lol.

DCount("*", "[name of the table]")

will do it...
 

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