DAO recordset

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

Guest

I opened a DAO recordset with the following rows. Althought the opened query
contains 2 records, the opened recordset'a recordcount is 1
(booked3.RecordCount = 1). This is a false value. But, after running the last
row (getrows), the booked3.recordcount = 2.

Why the booked3.recordcount = 1 after I opened the recordset?

" Set booked3 = dbs.OpenRecordset("SELECT Booked.* FROM Booked WHERE
(((Booked.[Cost Type])=70) AND ((Booked.[Cost Center])=11))", dbOpenSnapshot)
booked3.MoveFirst
bookeddb = booked3.RecordCount
bookt = booked3.GetRows(bookeddb)"

Thanks, Viktor
 
Juhaszv said:
Why the booked3.recordcount = 1 after I opened the recordset?

Because in VBA, Access doesn't know how many records there are until it has
found the last record. In fact, if you just open the recordset without
doing a MoveFirst, it won't even return a count of 1.

HTH - Keith.
www.keithwilby.com
 
Back
Top