Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a property that count the result of an SQL query.
I could find one that count the number of fields, but not the number of results. Is there another way to find out if an SQL return any result or no result are returned. Thanks Dan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Far as i know you have to run a loop for the number of records i.e. myrecordset.movefirst do until myrecordset.eof = true count = count + 1 myrecordset.movenext loop myrecordset.movefirst The way i find out if i have an empty recordset is if myrecordset.bof = true and myrecordset.eof = true then your code here end if hth keith |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Dan" wrote in message
... Is there a property that count the result of an SQL query. I could find one that count the number of fields, but not the number of results. Is there another way to find out if an SQL return any result or no result are returned. Dim strSQL As String Dim rcsCheck As New ADODB.Recordset Dim intNumberOfRecords As Integer ' strSQL = "Your Query" rcsCheck.Open strSQL, "Provider=MSDASQL;DSN=YourDSN", adOpenStatic, adLockOptimistic intNumberOfRecords = rcsCheck.RecordCount I tried a few things but this only seems to work for adOpenStatic, adLockOptimistic hth Gys |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count number of repeats in a column highlight result | Excel Discussion (Misc queries) | |||
Count result of sql query | Excel Discussion (Misc queries) | |||
Replace ^ in web query result | Excel Worksheet Functions | |||
Replace ^ in web query result | Excel Programming | |||
Importing result from Access query to Excel but the result only c. | Excel Discussion (Misc queries) |