Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Total Number of Records?

Status
Not open for further replies.

hongbin81

Technical User
Jul 4, 2003
61
KR
How do I display the total number of records?
Is there a function?

for example: total sum has function DSum
so what would total records be
 
use recordcount i think


Computers are like an array of randoms, ya never know what ya gonna get!!!
 
I believe it would be the same thing. Run a query to get rid of NULL values. Then run your Count function to count the number of any field. That should get you the total number of records. I hope this helps,

-Joey
 
open the table
' Note this is for ADO recordset
Dim Conn2 As ADODB.Connection
Dim Rs1 As ADODB.Recordset
Dim SQLCode as String
Set Conn2 = CurrentProject.Connection ' <<<<Note same as CurrentDb

Set Rs1 = New ADODB.Recordset

SQLCode = &quot;SELECT * FROM [YourTable];&quot;
Rs1.Open SQLCode, Conn2, adOpenStatic, adLockOptimistic
Rs1.movelast
Rs1.movefirst
debug.print Rs1.recordcount 'this is the total number of records

' close it this way
Set rs1 = nothing
Set Conn2 = nothing



DougP, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top