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

Subform control source error

Status
Not open for further replies.

FurryGorilla

Technical User
Apr 11, 2001
76
0
0
GB
Hi

I have a main form with a subform containing a sum of values on an order. The subform has a textbox named txtTotalNet which has it's control source set to '=Sum([Net])'. Because the records are displayed in datasheet view, I have a textbox on the main form with a control source of '=[frmPurchaseOrderTotals].[Form]![txtTotalNet]'. If there are records on the order the value is displayed correctly, however, when there are no records on the order the textbox has '#Error' inside. I've tried using an If statement with IsNull and IsEmpty as part of the control source but I don't seem to be having much luck.

Any help would be greatly appreciated.

Thanks
Chris
 
Just a thought

Try using the nz() function

This function is used to resove null value errors and is used like this.

nz(Myvalue,0)

If the value of "Myvalue" is null it would be replaced with a 0

There are many other ways to use the nz() have fun experimenting.

Good Luck
ssecca
 
Thanks ssecca. I managed to get it working using:

=IIf(IsError(frmPurchaseOrderTotals.Form!txtTotalNet),0,frmPurchaseOrderTotals.Form!txtTotalNet)

I thought I'd tried it this way already but I mustn't have typed it in correctly.

Thanks for the reply
Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top