Counting Records in a Pass Thru Query

aziz rasul

Active member
Local time
Today, 18:48
Joined
Jun 26, 2000
Messages
1,935
I have a Pass Thru query which has approximately a million records. I need to get the exact value. What code can I use in a module which will give me a FAST count value? Any help would be very much appreciated.

I have used a normal query which is taking forever to give the Count and is still running.
 
Either DCount or a "SELECT COUNT(*) FROM MILLION_TABLE" could work. I've heard DCount are as slow as hell. If there's a quicker way, I'd like to know too!
 
Do u know what code I would use to run this query. I'm not a SQL person, hence the reason for asking.
 
Code:
Dim strSQL as string
Dim rs as DAO.Recordset
Dim db as DAO.Database

strSQL = "SELECT COUNT(*) as RECCOUNT FROM MILLION_TABLE"
set db = CurrentDB
Set rs = db.OpenRecordset(strSQL)

msgbox rs.fields("RECCOUNT")
 

Users who are viewing this thread

Back
Top Bottom