When I use the RecordCount method I get -1 returned. According to VB Help its because ADO cannot determine the number of records. OK, but can anyone tell me why this might happen so I can correct it and get a record count?
You have a forward only cursor. In that situation you have to walk the recordset to get the recordcount.
Change your cursortype property to adOpenStatic. You may need to change locking to adLockBatchOptimistic.
A return value of -1 often means the cursor does not support the requested operation. Use the RecordSet.Supports method to find out if a particular recordset will support the function you are requesting. Oh and by the way, just because you open a recordset as a particular type, ADO can switch it down to another type with no warning... a type that may not support the operation you are looking for! Thanks MiscroSoft. Lost a few hairs on that one.
Even if a particular recordset type supports an operation, the OLEDB Provider or ODBC driver must also support that operation. Good luck finding out what operations are supported by which interface. trial and error.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.