Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / August 2006

Tip: Looking for answers? Try searching our database.

Handle Empty Recordset? - Acc2K

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony - 15 Aug 2006 15:42 GMT
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
Allen Browne - 15 Aug 2006 17:46 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.