Link to home
Start Free TrialLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

Record set

Hi experts, I wish to know why still got a message of "Yes" base on the codes below even the row is not exist?  I erased all unpaid from the table, SuppliersLedger  but still got a message of "yes" after removing it. Is there anyone who can give idea what's wrong on the codes? Thank you!

Public Function ObtainTotCreBal(code As String) 
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set rs = cn.Execute("Select Credit as TotCredit,Debit as TotDebit from SuppliersLedger where Status='" & "Unpaid" & "'")
    With rs
        If rs.BOF = True And _
            rs.EOF = True Then
            MsgBox "No"
        Else
            MsgBox "Yes"
        End If
    End With
Set ObtainTotCreBal = rs
Set rs = Nothing
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Whing Dela Cruz

ASKER

Thank you sir, its working..
You're welcome and I'm glad I was able to help.

If you expand the “Full Biography” section of my profile you'll find links to some articles I've written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017