Solved

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

Posted on 2013-05-31
6
2,859 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 85
ID: 39211768
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
ID: 39217526
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 85
ID: 39217722
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Accepted Solution

by:
ahf50 earned 0 total points
ID: 39219978
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
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 39220134
ahf50,

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

Author Closing Comment

by:ahf50
ID: 39232745
I found the solution before anyone came up the answer..
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

717 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