Summing Subform data in Datasheet View (1 Viewer)

dgambale@gmail.com

Registered User.
Local time
Yesterday, 19:18
Joined
Jul 31, 2013
Messages
19
Hello,

I have form that uses the datasheet view as the default view. I have a subform within the datasheet where I am summing up a field call Quantity by putting an unbound field in the footer of the subform and referring to it in the main datasheet view.

The calculations seem to work but in the datasheet view the Summed data of the subform is initially shown as #Error. However when I click on the "+" button within the datasheet the calculation is performed for that row and all looks good.

The question is, how do I get every row to automatically calculate the data from the subform without having to go into each individual record by pressing the "+"? Right now it just shows #Error until I click the +

Thanks for the help
 

Ranman256

Well-known member
Local time
Yesterday, 19:18
Joined
Apr 9, 2015
Messages
4,339
datasheets cannot show subforms.
if you make the subform a continuous form, then the footer can show the sum of the records.
put a text box in the footer and set the source = SUM(field)
 

missinglinq

AWF VIP
Local time
Yesterday, 19:18
Joined
Jun 20, 2003
Messages
6,423
...datasheets cannot show subforms.

They do when the + button is clicked on, as the OP has stated.

Try this code, which automatically expands the related records on opening the main form, and see if that does what you need:

Code:
Private Sub Form_Load()
  Me.SubdatasheetExpanded = True
End Sub
Linq ;0)>
 

Users who are viewing this thread

Top Bottom