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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting the current position of a recordset

Status
Not open for further replies.

zoomby

Programmer
Aug 5, 2002
60
0
0
DE
Hi!

How do I get the current position (row) of a recordset?
I tried AbsolutePosition, but it always returns -1.

Bye
Chris
 
Not an expert on recordsets and stuff but if your using DAO recordsets then I think the AbsolutePosition property only returns the correct position for dynaset or snapshot recordsets.

If your recordset has no records in it it will return -1. So check your recordsets to ensure that you have records within your recordset.
 
hi!

I'm using ADO and there are records in the recordset.

bye
chris
 
Hi,
As Taslin said, open your recordset as a dynaset and check if it has any records for the specified criteria. And I believe the position of the record would be Absolute Position + 1 ( zero based positioning of recordset, I believe ) Hope it helps. Let me know what happens.
With regards,
PGK
 
hi

I'm using ADO. I think it doesn't support "dynaset"...?

 
I'm not really sure how these recordsets work either, but it seems to be depend on the property settings for the Recordset and Command objects before you open the RS - for instance opening a Client-side Keyset recordset with Optimistic locking always seems to allow me to get the correct Recordcount and AbsolutePosition property values (i.e. not -1)

Dunno if this helps, just thought I'd chuck me oar in.
 
.bookmark Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top