Hello everyone, sorry for the title but I have trouble thinking of a way to out into words what my problem is at the moment.
I have a mainform that has two subforms.
SubformA is like an itemized detail of what is contained in the mainform.
SubformB is based on a query that summarizes SubformA based on what the mainform primary key is currently on.
In SubformB, there is a expression field that gives an amount value, which is then summed by a textbox called txtSumAmount which has a formula of Nz(Sum([Amount]),0) at the form footer.
I then call the value of txtSumamount to a textbox in the mainform called txtRunningTotal to serve as a running total.
Now everything only works if SubformA has records for the query on SubformB to sum. The running total textbox on the mainform displays the correct values.
However if for some reason the user did not add records in SubFormA (which is acceptable) or deletes all of them thereby emptying the sum query of SubformB, I get a blank value from txtSumAmount which displays a #size! error on txtRunningTotal.
How can I make txtSumAmount display zero instead of a blank or null, I don't even know what to call it.
I tried some of this in txtSumAmount so far, nothing has worked:
A) =IIf(IsNull(Sum([Amount])),0,Sum([Amount]))
B) I made another textbox control called txtCount with =Count(*) value at the footer to count records then on txtSumAmount = IIF(txtCount=0,0,Sum(Amount))
I'm currently stuck, does anyone have any suggestions? Thank you for your time.