Handle Empty Recordset? - Acc2K

T

Tony

Hi All,

I've got a database to which I need to make modifications based on client
changes. One of the functions of the database is to do some math on values
and deliver the results in a report. The reported values are hours
multiplied by $/hour. The requested changes will, from time to time,
produce an empty recordset for this calculation, i.e., there are no hours of
a specific type to be reported for a particular week.

Does anyone know if I can handle the empty recordset, either in the query or
in the report, in such a way that the report will not crash when the empty
recordset is encountered. Or, am I stuck?

Any help is appreciated.

Thanks & Ciao,

Tony
 
A

Allen Browne

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.)
 
T

Tony

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top