I'm using this code to sum a currency field in a table. The results are put into a text box called Text12.text. My problem is when the result of the sum is 0 I get an error: Invalid use of Null. I have tried to test for a value of 0 as you can see, but I still get the same error.
VB Code:
Set adoprimaryrs = New Recordset db.CursorLocation = adUseClient ssql = "SELECT SUM (Amount) as totalfld12 from donations where year(date) = Year(Date()) AND month(date) = 12" adoprimaryrs.Open ssql, db, adOpenStatic, adLockOptimistic If adoprimaryrs!totalfld12 = "" Then Text12.Text = 0 Else Text12.Text = adoprimaryrs!totalfld12 End If




Reply With Quote