Counting Records \(correct version\)
Guest
Slim Jim
Sorry about preovious post (accidentally hit Send,
posting only half the message !)
Here goes again, hope someone can advise...
I am connecting to a SQL Server stored procedure in Excel
VBA.
However, I am having difficulty COUNTING the number of
records returned from that Stored Procedure.
I have this code...
Dim conDB As New ADODB.Connection
Dim rstSP As New ADODB.Recordset
Dim strConnect As String
strConnect = "driver={sql server};server=
(local);database=mydb;uid=;pwd=;"
With conDB
.ConnectionString = strConnect
.Open
End With
'open the SP into recordset
conDB.storedprocname, rstSP
Now, I need to work out how many records have been
returned from the stored procedure into the recordset...
RecordCount DOES NOT WORK (it always returns -1), and I
need to be able to loop through the recordset but I can't
because I don't know how long it is !!
Please help !!
Cheers
Bookmarks