b/c i want to be able to run a query only once and then get a count of the number of rows. but then still be able with the recordset to got get the data from it to print to a table.<BR>see i need to output the total numb in the query and then the data.
it is possible to get the recored counts in many ways<BR><BR>1. use the same statement while retrieving the data from the back end (refer my comment below)<BR>2.you can use the record count property of the ado object but it gives u the value only when u move your cursor to the end of the record set so that after opening the recordset move the cursor to the end of the recorset and get the count and when u need to get the data from the recordset move it to the bof<BR>3.you can assign the same recordset to another record set using the set command like<BR>Set Rs2 = RS1<BR><BR>try any one of those
>you can use the record count property of the ado object but it <BR>>gives u the value only when u move your cursor to the end of <BR>>the record set so that after opening the recordset move the <BR>>cursor to the end of the recorset and get the count and when u <BR>>need to get the data from the recordset move it to the bof<BR><BR>as soon as you ouen the recordset if you do a rec.recordcount it should work fine. You do not have to always move to eof and then get the count ADO takes care of that. <BR><BR>I was told a long time ago that you will have to do that cause you will NOT have th right number or you will get a -1.<BR><BR>But i have noticed if ADO is going to give you the right number it will without moving to the EOF<BR><BR>I still say use an array to count the records.
the way the ado throws the record count is by knowing the cursor count and the cursor count will be -1 as you open the record because the cursor always by default sits in the bof, when you move the cursor to the eof the cursor count gets updated in the ado, so thz the way it works....
the ubound(arrName) will give you the total right<BR><BR>then use this array and populate the table.<BR><BR>If you have to have 2 recordsets then use the set keyword...R&D it<BR><BR>OR<BR><BR>After you do the rec.getrows then do a rec.MoveFirst and party on<BR><BR>You will HAVE TO do a rec.MoveFirst after you do a rec.getrows