Search Tools Links Login

Check if a RecordSet has Data

Posted: 2019-09-13
By: BrianGillham
Viewed: 165

Filed Under:

VB6 Databases, VB6 Function Enhancement, VB6 Code Cache

No attachments for this post


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

Special Instructions

This code originally appeared on AndreaVB.com, and has been republished here with the permission of Andrea Tincani.


Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.