Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

test for no records found

Status
Not open for further replies.

kronar

Programmer
Jan 12, 2003
60
US
I have a form that displays JobTime records in a subform. In the subform I total HbE from the query.
How can I use '=iif(iserror(sum(HbE), 0, sum(HbE))' as the Control Source of the field in the form footer?
 
If the subform allows additions, Nz will work, if not, the usual place to put the statement you show is on the parent form, with a proper reference to the subform.



 
the Form JobForm contains a subform JobTimesubform which is based on a query. In the footer of JobTimeSubform is a field 'TotalHrs' which has source =Sum(HbE)which is field in query.
On the JobForm I have afield whose source is [Form].[JobTimeSubfield]![TotalHrs]
If no records are found - I get #Error in the field.
How can I test for no data and load 0 instead?
 
Change the source from:

[Form].[JobTimeSubfield]![TotalHrs]

To

[tt]IIf(IsError([Form].[JobTimeSubfield]![TotalHrs]),0,[Form].[JobTimeSubfield]![TotalHrs])[/tt]

And see if that suits.

 
Thanks that worked, guess I needed the = in front of it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top