Findfirst?

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

Is it normal for the rst.FindFirst "Criteria" to error if there are no
records at all in the recordset? It works OK as long as there is at least
one record even if it doesn't match.


Should I be using .seek instead?
..seek seems to be more of a hassle to use.
 
Is it normal for the rst.FindFirst "Criteria" to error if there are no
records at all in the recordset? It works OK as long as there is at least
one record even if it doesn't match.

YES. From DAO36 help:
If a record matching the criteria isn't located, the current record pointer is unknown, and the NoMatch property is set to True.

Should I be using .seek instead?
..seek seems to be more of a hassle to use.

Not necessarily. But you should be checking the NoMatch property after .FindFirst.

From DAO36 help:

Always check the value of the NoMatch property to determine whether the Find operation has succeeded. If the search succeeds, NoMatch is False. If it fails, NoMatch is True and the current record isn't defined. In this case, you must position the current record pointer back to a valid record.


Steve
 
Whenever you open a recordset, you should always check to see if it is
empty, before you try to use it further:

set rs = ... openrecordset ( ... )
if rs.bof and rs.eof then
' empty.
else
' not empty.
' do more with it.
endif

HTH,
TC
 
Back
Top