ngreenleaf
Programmer
I am trying to find a good way to deal with an empty record set. I was using a DAO recordset, but when it is empty a MoveFirst does not work. It seems that issuing a MoveFirst would be safer than trusting that the pointer is initialized at the top of my recordset. I noticed that in ADO there is a BOF as well as EOF (but I didn't see such a thing in DAO) and you could test them and only issue the MoveFirst is they are not equal (eg empty set). I have discovered that there are issues with using RecordCount in DAO. Apparently the value 0 is accurate in indicating that the set is empty, but getting the actual count requires a MoveLast/MoveFirst. As a result I am not comfortable with using RecordCount.
Is RecordCount reliable... in which case I could do:
If abc.RecordCount <> 0 then abc.MoveFirst
Or is ADO better using...
IF abc.BOF <> abc.EOF then abc.movefirst
Or is issuing the movefirst totally unnecessary because it is a guarantee that when you do OpenRecordset it will be pointing at the first record?
I'm sure this is a style question to some extent... but I am interested in your solutions.
Is RecordCount reliable... in which case I could do:
If abc.RecordCount <> 0 then abc.MoveFirst
Or is ADO better using...
IF abc.BOF <> abc.EOF then abc.movefirst
Or is issuing the movefirst totally unnecessary because it is a guarantee that when you do OpenRecordset it will be pointing at the first record?
I'm sure this is a style question to some extent... but I am interested in your solutions.