mjdavie
11-07-2001, 05:42 AM
I have a text box on my main form which sums a column from my subform.
This all works fine except when there is no data in the subform the text box shows #Error.
Can anybody help me with this as it is driving me nuts
Thanks
crosmill
11-07-2001, 05:56 AM
there's a function called nz() that I think may help you out.
mjdavie
11-07-2001, 06:11 AM
I use this function in my calculation.
On my subform (in the footer of the form in form view)I have a text box which calculates the total:
nz(Sum([Total Purchases]))
I then reference this text box from a text box on my main form:
[TotalPaymentssubform]![Total]
I am wondering if this is the right way to go about it, I couldn't seem to sum the columns in the subform directly from my main form.
Any Ideas anybody Hope this isn't to confusing
crosmill
11-07-2001, 06:22 AM
Is the problem that the sum is incorrect, or that you can't reference it from the main form?
mjdavie
11-07-2001, 06:34 AM
The sum is correct as everything works fine when the subform contains data. If there is no data showing in the subform then I get the #error.
I am unable to use the Sum function and directly reference the column in the subform in one calculation.
Thanks for your help
crosmill
11-07-2001, 06:37 AM
If I'm reading this correclty, can you do the calculation direclty from the main form instead of referencing it to a calculated text box?
mjdavie
11-07-2001, 06:46 AM
I can't do the calculation from the main form
crosmill
11-07-2001, 07:13 AM
This isn't my speciality but I think you should be able to.
If you use the same calculation that you've use on the subform, but put "forms![subformName]" infront of each refernce to a text box, I think that might work.
*Feel free to jump in if I'm giving this guy duff information.*
mjdavie
11-07-2001, 07:29 AM
Unfortunately this doesn't seem to work maybe it's me but I am sure I have tried everything.
Thanks for your time and assistance
Try=Iif IsNull(Forms!MainFormName!SubFormName subform.Form!ControlNameOnSub," ",Forms!MainFormName!SubFormName subform.Form!ControlNameOnSub)