Number of rows in QUERY

  • Thread starter Thread starter Eric Dropps
  • Start date Start date
E

Eric Dropps

Looking for a way to determine number of rows in a QUERY...all i have found
is caouting a table or rows from a SQL statement---I need to do it from a
query (the query changes)

Thanks!
 
Eric, this works for me.

'---------------------------------------------------------------------------------------
' Procedure : subCountQueryRecs
' DateTime : 7/9/2004 16:41
' Author : UpRider
' Purpose : Count number of records returned by a SELECT QUERY
' and display the result in a message box
'---------------------------------------------------------------------------------------
'
Sub subCountQueryRecs(qQuery As String)
Dim intMsgBox as Integer
Dim reccnt As Long
swCancel = False
reccnt = DCount("*", qQuery)
intMsgBox = MsgBox("This selection will process " + Str(reccnt) + "
records", _
vbOKCancel, "R E C O R D S T O P R O C E S S")
If reccnt = 0 Or intMsgBox = vbCancel Then
swCancel = True
End If
End Sub

HTH
UpRider
 
Eric, you will need to add
DIM swCancel as boolean
to my previous code. It's a global var in my mdb so it wasn't needed locally
for me, but is needed in the sample code.

UpRider
 
Back
Top