Any arguments in the function must be variants, and the function must return
a variant.
At the top of the function, use IsError() to test the arguments, and if so,
return Null from the function.
(I am assuming here that the problem occurs when the report has no data,
rather than when a recordset opened inside the function has no records.)

Signature
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
> Hi All,
>
[quoted text clipped - 14 lines]
>
> Tony
Tony - 15 Aug 2006 18:05 GMT
Hi Allen,
Thanks for the quick reply. I hacked this by adding a 'base record' that
has a value of zero and it works, but I think I'll follow your advice as it
seems to be much cleaner.
Thanks,
Tony
> Any arguments in the function must be variants, and the function must
> return a variant.
[quoted text clipped - 23 lines]
>>
>> Tony