Solved

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

Posted on 2002-04-18
2
592 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 100 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

Independent Software Vendors: 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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

732 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