How to update the chart with new values?

BittenApple
BronzeLounger
Posts: 1498
Joined: 01 Mar 2015, 02:03

How to update the chart with new values?

Post by BittenApple »

Hello all,
:thankyou:
I have inserted a chart. I enter new values on the tables, the source value for the chart is a query, I run the query but the values on the chart doesn't get updated.
I have added values for new months but new months are not being shown on the chart.
How to update the values on the chart when the values on the table gets update?
Regards,
BitBit

User avatar
HansV
Administrator
Posts: 78519
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to update the chart with new values?

Post by HansV »

You can requery the chart, for example in the On Click event of a command button:

Code: Select all

Private Sub cmdUpdate_Click()
    Me.chtChart.Requery
End Sub
where cmdUpdate is the name of the command button and chtChart is the name of the chart control.
Best wishes,
Hans

BittenApple
BronzeLounger
Posts: 1498
Joined: 01 Mar 2015, 02:03

Re: How to update the chart with new values?

Post by BittenApple »

Hans,
Thanks so much for the code.
I thought if I can do a pivot chart in Excel that is connected to Access, it might be a solution.
Access 2016 doesn't pivot table/ chart review.
Regards,
BitBit

User avatar
HansV
Administrator
Posts: 78519
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to update the chart with new values?

Post by HansV »

Yes, you can do that (Excel charts are flexible and attractive), but users will have to open the Excel workbook to view the chart.
Best wishes,
Hans

BittenApple
BronzeLounger
Posts: 1498
Joined: 01 Mar 2015, 02:03

Re: How to update the chart with new values?

Post by BittenApple »

Hello Hans,
Yes, I might do both methods. Let me see how it goes. I can't decide what to do.

I watched a video tutorial about how getting a pivot table/ chart in Excel from Access. It was interesting. It inserted a table in Access with two fields : auto number and OLE Object and after connecting, if we click on the object on the table, we can open chart in Excel and data gets updated easily.

It got the value of query into Excel and inserted a pivot table and chart.The value for the fields whose data type is number came as zero, I don't know why:
My original query is like
I have 12 field. I averaged every 4 of them into one field and then query grouped on company and hospital.
The aggregated function for these grouped fields are average:

They came as 0 in pivot table. what could be the reason for it? What is your thoughts on it?

I am only concerned about this conflicting with splitting the database in next steps. What do you think?

My original query works well in database. First it averages 4 fields and then it averages across rows.

This is the link to this training:
how to get pivot tables and charts in access 2016
https://www.bing.com/videos/search?q=ho ... ORM=VRDGAR" onclick="window.open(this.href);return false;


Regards,
BitBit

User avatar
HansV
Administrator
Posts: 78519
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to update the chart with new values?

Post by HansV »

I have no way to tell why you get zeros in the pivot table. I'd have to see the database.
Best wishes,
Hans