If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
referring to Subform Total in main form
Hi,
This is probably very simple but has bugged me on more than one occasion. I have a main form / continuous subform setup, where the subform contains a control ctlFieldX bound to FieldX and a control ctlTotal in the form footer to display the sum of FieldX. This controlsource =sum([FieldX]) On my main form, I might have a control which references the total in the subform, with a controlsource =nz(Subform.Form!txtTotal,0) The problem occurs when the subform does not have any related records to display. If the AllowAdditions property of the sunform is set to True, the main form total control correctly displays 0. However, if the AllowAdditions property is set False, the main form total control displays #Error Can anyone tell me if there is a simple way around this? Thank you as always, Jim |
#2
|
|||
|
|||
referring to Subform Total in main form
Try checking whether Subform.Form.RecordsetClone.RecordCount is 0:
=IIf(Subform.Form.RecordsetClone.RecordCount, Nz(Subform.Form!txtTotal,0), 0) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Jim Franklin" wrote in message ... Hi, This is probably very simple but has bugged me on more than one occasion. I have a main form / continuous subform setup, where the subform contains a control ctlFieldX bound to FieldX and a control ctlTotal in the form footer to display the sum of FieldX. This controlsource =sum([FieldX]) On my main form, I might have a control which references the total in the subform, with a controlsource =nz(Subform.Form!txtTotal,0) The problem occurs when the subform does not have any related records to display. If the AllowAdditions property of the sunform is set to True, the main form total control correctly displays 0. However, if the AllowAdditions property is set False, the main form total control displays #Error Can anyone tell me if there is a simple way around this? Thank you as always, Jim |
Thread Tools | |
Display Modes | |
|
|