Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Urgent: Unable to change the RowSource property in a chart object through macro ot code.

Posted on 2002-04-18
2
Medium Priority
?
596 Views
Last Modified: 2008-07-07
Hi everybody,

In my database, I produce a report with charts. These charts are not to be based on records in a table but on calculated controls on the report itself.
To do that, I want to be able to change the rowsource property through either a macro or some code started when the report is open. (note: the Rowsourcetype is set to Value List and column count to 4.) It seems simple yet it does not work!

Both when I use a macro (SetValue) or the code below, I receive the following error message: “Run-time error ‘2455’: you entered an expression that has an invalid reference to the property RowSource.”

However, when I use the same code in a form, it works fine. Should I understand that what is true for a form in not true for a report. Or is there a way to solve this issue?

Thanks.

Arnaud


Private Sub Report_Open(Cancel As Integer)
    Dim Chartsource As String
    Chartsource = "Road ; Paved ; Maintainable ;  Maintained ;  Country ; .95 ; .50 ; .25 ; Region ; .10 ; .45 ; .35"
    Me!Network_condition_graph.RowSource = Chartsource
End Sub
0
Comment
Question by:desmarch
[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
2 Comments
 
LVL 2

Accepted Solution

by:
xtrahands earned 300 total points
ID: 6951774
I'm pretty sure that the rowsource cannot be changed at runtime.  Instead you need to open the report in design view change the rowsource and then open the report in preview/print mode.  E.g.

Sub chnggraph()

Dim Chartsource As String
Dim rpt As Report

 
DoCmd.OpenReport "Report1", acViewDesign
Set rpt = Reports("Report1")
Chartsource = "Road ; Paved ; Maintainable ;  Maintained ;  Country ; 0.95 ; .50 ; .25 ; Region ; .10 ; .45 ; .35"
rpt!Network_condition_graph.RowSource = Chartsource

Set rpt = Nothing
DoCmd.OpenReport "Report1", acViewPreview

End Sub
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7119830
for desmarch

No comment has been added for the last two months.
So it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0

Featured Post

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!

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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.

609 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