Solved

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

Posted on 2013-05-31
6
2,565 Views
Last Modified: 2013-06-09
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
Comment
Question by:ahf50
  • 3
  • 2
6 Comments
 
LVL 84
Comment Utility
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
 

Author Comment

by:ahf50
Comment Utility
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
 
LVL 84
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Accepted Solution

by:
ahf50 earned 0 total points
Comment Utility
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.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
ahf50,

Were you able to determine how to reference the value in those columns of that Totals row?
0
 

Author Closing Comment

by:ahf50
Comment Utility
I found the solution before anyone came up the answer..
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now