Re: Empty "If Me.Recordset Is Nothing Then" clause causes runtime error 3021 (Access 2003)

From: david epsom dot com dot au (david_at_epsomdotcomdotau)
Date: 08/24/04


Date: Tue, 24 Aug 2004 14:06:09 +1000

BOF and EOF are set by a MOVE command. If you do not do a MOVE,
then BOF and EOF will not be set. It is quite easy to get a
recordset with no records, but BOF and EOF both false: just delete
the records from the recordset so that it is empty. (This is,
or was, documented in the help file, and last I checked remains
true in all versions of Access).

There are a number of actions that implicitly do a MOVE action:
these implicitly set BOF and EOF. If the implicit implicits have
become to remote, or if you are doing deletes on the recordset,
you may wish to reconsider use of the MOVE flags.

(david)

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:uRyNICTiEHA.596@TK2MSFTNGP11.phx.gbl...
> "Boris" <boris@gtemail.net> wrote in message
> news:#nyxezSiEHA.3928@TK2MSFTNGP11.phx.gbl...
> > In our test database a call to Requery updates RecordCount to 0 but not
> BOF
> > and EOF to false. In my opinion this is a bug in Access and not in the
> help
> > file. Or is there any reasonable explanation why BOF and EOF should be
> true
> > if RecordCount is set to 0?
> >
> > Boris
>
> PMFJI, but if there's no data in the recordset, then BOF and EOFshould be
> true.
>
> From the Help file:
>
> The BOF property returns True if the current record position is before the
> first record, and False if the current record position is on or after the
> first record.
>
> The EOF property returns True if the current record position is after the
> last record, and False if the current record position is on or before the
> last record.
>
> When the recordset is empty, then there's no way that either can be False
by
> definition.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (No private e-mails, please)
>
>
>
>



Relevant Pages