• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3043
  • Last Modified:

VBA Datasheet view Ms Access how to reference the total row cells

I am trying to dynamically select columns in the new feature of Datasheet view. total row and turn on or off total row plus change the aggregation selection. Any help would be helpful.
0
ahf50
Asked:
ahf50
  • 3
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I don't believe you can get that data. You'd have to instead create your own Sums in code, either by using a Recordset or by using one of the Domain Aggregate methods (like DSum).
1
 
ahf50Author Commented:
I found the properties in VBA but I am not sure how to change them.
in the Recordset.properities(38) = TotalsRow (true or False)
in the Recordset.Fields(0).Properties(27) = AggregateType
   using 0 = sum
currently Read only..
Does anyone know how to set the properties of a form's query. on open or on current event.
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I don't have a clue, but you can't do much with the attributes ... all that does is tell you the capabilities of the object (in this case, your recordset).

Perhaps others might have better insight ...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ahf50Author Commented:
Ok I figured it out.. you can use
in design mode of the form.
me.formname.form.recordset.properties("Totalrow") = True
for this part open the form in design mode and enable the total row using the method msdn and microsoft says to do.

now if you want to set the aggreation at run time. you can.
on form open event..
me.controls("fieldname").Properties("AggregateType") = 0 gives you Sum
but you can use -1 to turn it off.
1 give you the next one in the list.
any got this to open a form and apply sum to the fields that I wanted it to be applied.
1
 
Dale FyeCommented:
ahf50,

Were you able to determine how to reference the value in those columns of that Totals row?
0
 
ahf50Author Commented:
I found the solution before anyone came up the answer..
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now