AbsolutePosition Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using ODBC to a SQL database I use the code;
Label1.Caption = record_rst.AbsolutePosition & " of " &
record_rst.RecordCount giving '4 of 256' for example. My problem, I am now
connecting to an MS Access database and it is returning ... '-1 of 256' any
suggestions
 
It sounds like you are still using ADO Recordsets, rather than ADO .NET
DataTables and DataSets, right?

AbsolutePosition and RecordCount were never recommended for reliable results
in ADO since updates by others could throw those values off. If you are
recieving -1 for AbsolutePosition, it's probably because you are positioned
prior to the first record at the Beginning Of File (BOF) marker.

You should consider using ADO .NET and loading your data into DataTables &
DataSets. You could then use the index value of a given record in the
DataTable's Row collection.

-Scott
 
Its probably becuase you are not using client sided cursor. Make sure you
set the .cusorlocation of the recordset to 3 (adUseClient) prior to opening
to get an accurate recordcount.

Scott Emick
VB Programmer
 
But, if you are going to do this, you might as well just use ADO .NET and
gain all the other benefits of it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top