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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle a calculation if the subform has no value?

Status
Not open for further replies.

Xenos132

Technical User
Dec 12, 2004
43
CA
I have sub reports based on queries, I am trying to total their values however if a sub report has no records I get an error. I was thinking Nz may help but it doesn’t seam to work.

=([RepTimeSheetsQuery]![TotalM].Value)+(Nz([RepHelperTimeQue]![TotalH].Value,0))

How do I get a default of 0 is a field doesn’t exist?
 
You need to use the HasData property of the subreport control:
=IIf(subrptControl.Report.HasData, subrptControl.Report!txtTotal,0)

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top