If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Recordset Counts

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-15-04, 16:04
friendly friendly is offline
Registered User
 
Join Date: Dec 2003
Posts: 4
Recordset Counts

I am trying to count the number of records in a recordset I have created. It always returns a value of -1 nomatter how many records are actually there. I have other operations working fine using similar code, but this one will not work correctly. Can anyone help. Here is the code.

Set ashcontentcountcmd = New ADODB.Command
ashcontentcountcmd.ActiveConnection = ashconn
Set ashcontentcountrs = New ADODB.Recordset
ashcontentcountrs.ActiveConnection = ashconn

ashsource = lstash.List(lstash.ListIndex)

ashcontentcount = "select ID from Flyash where Source ='" + ashsource + "'"

ashcontentcountcmd.CommandText = ashcontentcount ashcontentcountrs.Open ashcontentcountcmd

Debug.Print ashcontentcountrs.RecordCount


Thank you in advance for any help.

Michael
Reply With Quote
  #2 (permalink)  
Old 01-15-04, 23:17
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
You need to make it a client-side cursor to return the recordcount or your cursor is the wrong type.
Reply With Quote
  #3 (permalink)  
Old 01-16-04, 12:14
friendly friendly is offline
Registered User
 
Join Date: Dec 2003
Posts: 4
I am new to this stuff. I don't know what you mean by a client-side cursor. This is an Access database I am connecting to.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On