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

How do I insert a value on the main report if no subreport value exist 1

Status
Not open for further replies.

Apollo6

Technical User
Jan 27, 2000
418
US
I have a main report with a subreport. The two are linked by a jcode. I find an amount for Drug#1 on the main report and then find an amount for Drug#1 on the subreport. Basically, main table is Insurance#1 and subreport is Insurance#2. I then calculate a difference from the two. The problem comes when there isn't a Drug#1 in the subreport. My formula gets an error because an amount minus a null = error. I have tried using IsNull/HasData but without success.

This is the control source on my text box:
=[ttl_allowable]-[Reports]![rptPlan_Comparison_By_Payor]![rptPlan_Comparison_By_Payor_Sub]![ttl_allowable]

How can I make the subreport value equal 0 if nothing is matched and brought back?

Or

Is there a way to link the main report and subreport to where only matching JCode records are brought back in the subreport?

Any suggestions are appreciated.
 
Try something like:
=[ttl_allowable]-IIF([rptPlan_Comparison_By_Payor_Sub].Report.HasData,[rptPlan_Comparison_By_Payor_Sub].Report.[ttl_allowable],0)

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top