Hi All, I have a subform which has a field in the footer to calculate the sum of a field =Sum([SaleAmount]).
On the main form, I have a textbox that references the subform's [SaleAmount], Main form control =[Forms]![MainForm].[MainForm_subfrm].[Form]![SaleAmount]
I have a combo box which looks up a list of reports and then requeries the recordsource for the subform by the selection.
On the AfterUpdate even of the Combo box on the main form, I requery the subform recordsource, and the SaleAmount on the main form, recalculates itself without any problems.
However, when the main form loads, I have put in the OnLoad event to set the recordsource of the subform to the first value in the combo box. This displays the correct records on loading.
But, the Sum([SalesAmount]) = 0, on the Main form, no matter how many records are showing.
I think I'm missing something with the OnLoad event.
I checked the subform on it's own, and it had no problems showing the Sum([SalesAmount]). I even used the same code that works in my AfterUpdate event of the combo box, and put it in the OnLoad event, but still no success.
I'm a bit lost as to why it works fine for my combo box but just doesn't work when the form is first loaded up?
On the main form, I have a textbox that references the subform's [SaleAmount], Main form control =[Forms]![MainForm].[MainForm_subfrm].[Form]![SaleAmount]
I have a combo box which looks up a list of reports and then requeries the recordsource for the subform by the selection.
On the AfterUpdate even of the Combo box on the main form, I requery the subform recordsource, and the SaleAmount on the main form, recalculates itself without any problems.
However, when the main form loads, I have put in the OnLoad event to set the recordsource of the subform to the first value in the combo box. This displays the correct records on loading.
But, the Sum([SalesAmount]) = 0, on the Main form, no matter how many records are showing.
I think I'm missing something with the OnLoad event.
I checked the subform on it's own, and it had no problems showing the Sum([SalesAmount]). I even used the same code that works in my AfterUpdate event of the combo box, and put it in the OnLoad event, but still no success.
I'm a bit lost as to why it works fine for my combo box but just doesn't work when the form is first loaded up?
Last edited: