PC Review


Reply
Thread Tools Rate Thread

count number of sql query result

 
 
=?Utf-8?B?RGFu?=
Guest
Posts: n/a
 
      25th Jun 2007
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

 
Reply With Quote
 
 
 
 
Keith74
Guest
Posts: n/a
 
      25th Jun 2007

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

 
Reply With Quote
 
GysdeJongh
Guest
Posts: n/a
 
      25th Jun 2007
"Dan" <(E-Mail Removed)> wrote in message
news:92770EDA-7F95-4377-9552-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Count the result of a query in VBA? =?Utf-8?B?S29vcm9zaA==?= Microsoft Access VBA Modules 2 29th Jun 2007 08:38 AM
Count result of sql query =?Utf-8?B?RGFu?= Microsoft Excel Misc 0 25th Jun 2007 04:50 PM
use count query result in an IF statement michael goodall Microsoft Access Queries 1 15th Mar 2007 05:39 PM
How do I run a query depending on the result of a count query? =?Utf-8?B?Q0Y=?= Microsoft Access 3 15th Feb 2006 02:14 AM
Need to Count Records in Query Result set =?Utf-8?B?Uk5VU1pAT0tEUFM=?= Microsoft Access Forms 3 9th Aug 2005 10:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:30 PM.