Solved

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

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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access 2016 importing text files 13 21
ACCESS 2010 - VBA - generic Table Open Button - Code 7 24
Access on Mouse move 5 34
My SQL as Backend for Access 3 14
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 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