Recs Function:

The Recs function returns a long representing the record count returned by an SQL statement. There are two required arguments: ConnString and SQL. ConnString must be set to a valid database connection string and SQL must be set to a valid SQL statement. Recs returns Null if error handling is enabled and a problem is encountered while obtaining a record count.

Syntax:
long = Recs(connstring, sql)
Example Usage:
Use Recs to determine the record count returned by an SQL statement.
<%
Dim a
a = Recs("DSN=mydsn", _
	"SELECT ID FROM table WHERE date_field BETWEEN '3/2/00' AND '4/7/00';")
response.write a & " Records Found!"
%>
ASP Source Code:
<%
Private Function Recs(byVal connstring, byVal sql)
	Const adOpenStatic = 3, adLockReadOnly = 1, adCmdText = &H0001
	Dim objCn, bErr1, bErr2, strErrDesc, objRs
	On Error Resume Next
	Set objCn = Server.CreateObject("ADODB.Connection")
	objCn.Open ConnString
	If Err Then 
		bErr1 = True
	Else
		Set objRs = Server.CreateObject("ADODB.Recordset")
		objRs.Open sql, objCn, _
			adOpenStatic, adLockReadOnly, adCmdText
		If objRs.BOF then
			Recs = 0
		Else
			Recs = CLng( objRs.RecordCount )
		End If
		objRs.Close
		Set objRs = Nothing
		If Err Then 
			bErr2 = True
			strErrDesc = Err.Description
		End If
	End If
	objCn.Close
	Set objCn = Nothing
	On Error GoTo 0
	If bErr1 then
		Err.Raise 5109, "Recs Function", "Bad connection " & _
				"string. Database cannot be accessed."
		Recs = Null
	ElseIf bErr2 then
		Err.Raise 5109, "Recs Function", strErrDesc
		Recs = Null
	End If
End Function
%>