Jimmy Turnip
Registered User.
- Local time
- Today, 19:09
- Joined
- Sep 26, 2000
- Messages
- 18
It's OK! I've solved my own problem by using the IsNull() function instead of If Object Is Null ...
I love VBA. I love VBA. I love VBA. I love...
----------------------------------------------------
I have code similar to this in my program:
With MyRecordset
If .RecordCount > 0 Then _
** MyFunction = IIf(.Fields!MyTotal Is Null, 0, .Fields!MyTotal)
End With
MyRecordset is based on an SQL statement similar to this:
SELECT Sum(MyTable1.MyField) AS MyTotal
FROM MyTable1 INNER JOIN MyTable2 ON blah blah blah
WHERE {includes criteria on both tables}
If there are no records matching the criteria following the WHERE clause then the value returned is Null. When I run the program I get run-time error 'object required' when it hits **.
I keep coming back to this bug, but I just can't see how to solve it. I've checked for spelling errors, etc., and the program definately recognises MyRecordset because you can see it in the Watch window.
Ahhhh! Any help would be greatly appreciated.
Thanks.
[This message has been edited by Jimmy Turnip (edited 10-25-2000).]
I love VBA. I love VBA. I love VBA. I love...
----------------------------------------------------
I have code similar to this in my program:
With MyRecordset
If .RecordCount > 0 Then _
** MyFunction = IIf(.Fields!MyTotal Is Null, 0, .Fields!MyTotal)
End With
MyRecordset is based on an SQL statement similar to this:
SELECT Sum(MyTable1.MyField) AS MyTotal
FROM MyTable1 INNER JOIN MyTable2 ON blah blah blah
WHERE {includes criteria on both tables}
If there are no records matching the criteria following the WHERE clause then the value returned is Null. When I run the program I get run-time error 'object required' when it hits **.
I keep coming back to this bug, but I just can't see how to solve it. I've checked for spelling errors, etc., and the program definately recognises MyRecordset because you can see it in the Watch window.
Ahhhh! Any help would be greatly appreciated.
Thanks.
[This message has been edited by Jimmy Turnip (edited 10-25-2000).]