Access VBA: How to test if recordSet is empty? isNull?

Posted by Shubham on Stack Overflow See other posts from Stack Overflow or by Shubham
Published on 2011-07-22T16:29:46Z Indexed on 2014/08/20 10:21 UTC
Read the original article Hit count: 245

Filed under:
|

How can you test if a record set is empty?

        Dim temp_rst1 As Recordset
        Dim temp_rst2 As Recordset

        Set temp_rst1 = db.OpenRecordset("SELECT * FROM ORDER_DATA WHERE SKUS_ORDERED = '" & curSKU1 & "' AND [ORDER] = " & curOrder)
        Set temp_rst2 = db.OpenRecordset("SELECT * FROM ORDER_DATA WHERE SKUS_ORDERED = '" & curSKU2 & "' AND [ORDER] = " & curOrder)

        If IsNull(temp_rst1) Or IsNull(temp_rst2) Then MsgBox "null"

I'm opening up a couple of record sets based on a select statement. If there are no records, will IsNull return true?

© Stack Overflow or respective owner

Related posts about ms-access

Related posts about access-vba