473,320 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Changing data field in a pivot chart via button (vba)

374 256MB
All,

Basically I am trying to change my pivot chart a bit more dynamically.

I have a sub form with a query recordsource which contains all the fields I would require to create TWO pivot charts.

The sub form opens as pivot chart view and ofcourse is placed as a control on my main form.

I am trying to design my form with some code so that when I click buttons on my main form the data categories on the axis of the pivot chart change to predefined (by the code) data series I have set.

This in my mind seems very simple since it is literally just asking my pivot chart to stop using a category for the Y axis such as [NCCost] to now picking out [NCEventCount] from its record source (query).

I have been looking for ages at code and it seems to always reference excel forums. Anyway.. this is what I have at the moment:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnsettocosts_Click()
  2. Dim objChartSpace As OWC10.ChartSpace
  3.    Dim objPivotChart As OWC10.ChChart
  4.    Dim frmChart As Access.Form
  5.  
  6.    Set frmChart = Me.Controls("subfrmPivot2").Form
  7.    Set objChartSpace = frmChart.ChartSpace
  8.    Set objPivotChart = objChartSpace.Charts.Item(0)
  9.  
  10.  
  11. End Sub
It took long enough to get to there as I was having issues with the OWC10 reference, however that is now fixed and I cant face struggling on anymore.

Thanks for any help,

Chris
Aug 24 '10 #1
0 1407

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: GoalieGW | last post by:
Does anyone know how to create a Pivot Chart at run-time? I have a database of meter readings that currently requires me to have 200 forms created so the user can enter date criteria and have a...
1
by: keliie | last post by:
Hello, I've created a form that contains a single unbound combo box and two subforms. The two subforms display the results of a query (driven by the combo box selection) in both tabular and...
1
by: mike11d11 | last post by:
I was wondering if it was possible to export information from a pivot chart when double clicking on the item I want. For example I have a pivot chart with Four items in the legend and they are...
1
by: erbrose | last post by:
Hey, fairly new to vba. here is what i am trying to achieve in a nutshell. I want a user to be able to select a record from a listbox or combo box (values retrieved from a table). once they select...
1
by: devagupt | last post by:
i have a form called get downtime data. WHen information is entered into it and the button "get downtime data" pressed , it displays the results of a query. WHen i view the query in pivot chart view...
1
by: thomas.wordsworth | last post by:
This is a bit of a two-part question. 1. Is there a way to control what filters are placed on a pivot chart via vba. I can easily change the underlying query and refresh pivot chart but it's...
1
by: mkknerr | last post by:
I have a pivot table that has calculated fields (by Row and or Column) and every time I try to view as a pivot chart it reverts back to the count not the calculated field. Can this be done and if so...
0
by: Skywalker103 | last post by:
Hello all I have realy big problem. I have txt file linked as linked table to my mdb database. This table can contain aproximatelly 1 000 000 records (teoretically), but real count is 100-500...
1
by: goldxr | last post by:
Hi, Has anyone come across a print report macro that updates any changes you make on a main form? The issue I have is I have a pivot chart called It is a sub form in the main form I...
0
by: inepu | last post by:
Is there any way to show a field in a pivot table/chart that is calculated based on other fields of the pivot? I have the following table: Date; DescriptionField_1; Slots; EmptySlots I want...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.