'Sum values in Access Subform that have a checked box and show on Main Form

my problem is similar to Subform totals value to textbox in form returns error . I have a subform containing quantities, prices, trades dates, etc. for trades that have occurred and that data will change depending on which ticker is chosen from a combo box in the main form.

There is also a check box in each row of the subform. My end goal, is to have a textbox in the mainform that shows the summation of the quantities for the trades where the checkbox is checked.

I have googled and youtubed for days and the most common answer is the following: create a textbox in the footer of the subform that contains =Sum(IIf([Check]=True,[Quantity],0)) . Essentially, if the checkbox is checked then sum the quantities of the rows with a checked box. Then create a textbox in the mainform that references the textbox in the footer of the subform. This should display the desired quantities; however, I am getting #error in the textbox on the main form instead and I'm not sure why.

Please let me know if I need to clarify further. If anyone can help I would greatly appreciate it!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source