Check if a RecordSet has Data

By | 2019-09-13

Before you can query for a recordset, you need to make sure it has data in it.

Public Function EmptyRS(ByRef adoRS As ADODB.Recordset) As Boolean
    'Checks for an EMPTY RecordSet
    On Error GoTo ErrHandler
    EmptyRS = True
    If Not adoRS Is Nothing Then
        EmptyRS = ((adoRS.BOF = True) And (adoRS.EOF = True))
    End If
Exit Function
ErrHandler:
    EmptyRS = True
End Function

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.