How do i test a recordset before using the fields? Can you simply test for
If not (rst.eof) and not (rst.bof) then
debug.print rst.fields(0)
End If
My only concern with this test is that I don't know if a recordset can open
at EOF or BOF even if it's not empty. I only want to skip empty recordsets
to avoid errors. My recordset is a SQL query.

Signature
Billy Rogers
Dallas,TX
Currently Using Office 2000 and Office 2003
Douglas J. Steele - 26 Sep 2006 16:24 GMT
What you've got is the appropriate check.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> How do i test a recordset before using the fields? Can you simply test
> for
[quoted text clipped - 10 lines]
> recordsets
> to avoid errors. My recordset is a SQL query.
Alex Dybenko - 26 Sep 2006 16:31 GMT
Hi,
yes, this is a right approach

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> How do i test a recordset before using the fields? Can you simply test
> for
[quoted text clipped - 10 lines]
> recordsets
> to avoid errors. My recordset is a SQL query.
Dirk Goldgar - 26 Sep 2006 16:50 GMT
> How do i test a recordset before using the fields? Can you simply
> test for
[quoted text clipped - 8 lines]
> can open at EOF or BOF even if it's not empty. I only want to skip
> empty recordsets to avoid errors. My recordset is a SQL query.
If you *know* the recordset has just been opened, then you need only
check for either rst.EOF or rst.BOF. The recordset will be opened at
the first record, if there are any records in it. However, if there's
any question that the recordset's current record pointer may have been
moved since it was opened -- and especially if you've just been handed a
recordset from somewhere -- checking for both conditions is the right
way to do it.

Signature
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)