Code:
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\home.mdb"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "select sum(income),sum(Spendecher) from main where date between #" & DTFr.Value & "# and #" & DTTo.Value & "#", cn
Label3.Caption = rs(0) 'Your total Income..
Label5.Caption = rs(1) 'Your Total Expenses..
rs.Close
a = Label3.Caption
b = Label5.Caption
the above code works fine. but after few days it show a msg, " Invalid use of null"
Why this msg show? and highlight this
Code:
Label3.Caption = rs(0)
then I change the code. I write
Code:
If Not IsNull(rs.Fields(0)) Then
Label3.Caption = rs.Fields(0)
End If
If Not IsNull(rs.Fields(1)) Then
Label5.Caption = rs.Fields(1)
End If
now show "Type mismatch" and highlight any body help me why the 1st msg show and now what I need to do?