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

#ERROR from subreport

Status
Not open for further replies.

danman226

Programmer
Dec 16, 2002
6
0
0
US
I have a report and two sub reports. The main report is calculating an addition on a sum from each of the sub reports. The problem comes when one of the subreports has no data. The addition in the main form will then print an #error. I assume it is because the subform contains no data and trying to add a non existant value which gives the error.

If a subreport has no data, can I set a default value to use? How do I get around this error?
 
You could set a default value of 0 into your calculated fields or you could use and IIF statement

iif(isnull(rptname!srptname.report!fldnm, rptname!srptname.report!fldnm= 0 ,rptname!srptname.report!fldnm= rptname!srptname.report!fldnm)

do this for each of the subreports and then do the addition

hope this offers some guidance.

if you post the rpt names I'll be happy to furnish you with the functioning syntax - my syntax for reports is a little rusty.

jo




 
I just came across this today too and was about to post a question - I came up with this solution, creating a function in a module then setting the field to the function, this is that function i wrote:


Public Function Crap(curValue As Variant) As Currency

On Error GoTo ErrorHandler

Crap = curValue

ExitFunction:
Exit Function

ErrorHandler:
Crap = 0
Resume ExitFunction

End Function



I too was wondering if there was an easier way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top