rs.recordcount reporting wrong number of records
i got an access db with this query, called qryallbooks, inside the db:
SELECT tblBook.BookID, tblBook.BookName, tblBook.AuthorFirstName, tblBook.AuthorSecondName, tblBook.BookEdition, tblBook.ISBN, tblBook.Price, tblBook.WebLink, tblBook.DeweyCode
FROM tblBook;
then in my vb6 app i do this:
Set qd = dB.QueryDefs("qryAllBooks")
Set rs = qd.OpenRecordset
msgbox rs.recordcount
i get 1, however the table clearly has 2 records, i can tell coz i opened up the tbl in access and had a look. i also can do rs.movenext 2 times with no errors.
what is going on? how do i make rs display the right number of records?
Re: rs.recordcount reporting wrong number of records
In DAO you need to do an rs.MoveLast to get the right count.
This might be of interest:
http://www.microsoft.com/officedev/tips/rscount.htm
VB Code:
Set qd = dB.QueryDefs("qryAllBooks")
Set rs = qd.OpenRecordset
rs.MoveLast
rs.MoveFirst
msgbox rs.recordcount
Re: rs.recordcount reporting wrong number of records
:afrog: that is so strange, thnx u.