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

Access db & Cursor Types & Recordsets

Status
Not open for further replies.

DirtyB

Programmer
Mar 13, 2001
159
US
I am having a problem with my recordsets. I need to use the rs.recordcount property to display my results correctly. The recordcount always returns a -1 even if there are records in it. I can print the data from the recordset just fine, but I can't count the records.

One would assume that this is a cursor-type problem. I have changed my cursor to all kinds and it still doesn't work. I've tried the "movelast", "movefirst" and other variations. Someone also told me that since i'm using and MS Access database, that it doesn't support other types of cursors. I don't know if that's true or not, but any help would be appreciate.

In a nutshell, all I need to do is get an accurate count of the records being returned to my recordset from this Access database.

Thanks
 


DirtyB,

Try using this format:

' rsTmp.open strSQL, CnTmp, adOpenKeyset, adLockOptimistic
rstmp.open "SELECT * FROM Table", Conn, 1, 3

Fengshui1998
 
For future reference, try reading:

PRB: ADO: Recordcount May Return -1

For future testing purposes, you may also find it beneficial to learn to utilize the recordset's Support method to determine if a specific cursor supports specific functionality. Refer to the ADO docs for more info. Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top