Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining Record Count and Record Number

Status
Not open for further replies.

RickLiebespach

Programmer
Sep 29, 2003
85
US
Question:
How do I determine how many records are in my RecordSet?
and
How do I determine what is the record number of the record I am currently on?

What I want to accomplish is to be able to tell the user that they are currently on record 5 of 23,217
or something like that.


Rick Liebespach
 
easiest way is to load the into an array using getRows()

set rs = cn.execute("select * from myTable")
allRows = rs.getRows()

ttlCount = uBound(allRows,2) + 1

for x = 0 to uBound(allRows,2)
response.write "you are on row " & x & " of " & ttlCount
next



Are you paging your results? 23K records - you should page...


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
I'm not sure your solution will completely meet my need.
I can get the record count by opening static and doing
objRecordSet.RecordCount

But I'm not sure I can get the current record number...
Part of what I'm doing is using
objRecordSet.Find

objRecordSet.Find "Unique_ID = '" & Session("Notes_Unique_ID") & "'"

and I'd like to know the record number of the record I just found.

Any ideas?
TIA,
Rick

Rick Liebespach
 
Does this help?


AbsolutePosition Property
Sets or returns a long value that is the ordinal position of the cursor.

Syntax: recordsetobject. AbsolutePosition

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Do a SELECT COUNT(*) FROM ??? to return the number of records. Then simply keep a counter on what record you are on. The AbsolutePosition does not work well if you are doing anything except Access databases. - Some drivers return erroneous or no information for this property.


Greg Conely
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top