Sync Form and Report with Chart

M

Mauricio Silva

Hi there,

I have a form where I can see a chart. It works fine. I change the query
dynamicly according to the parameters I select. In my report (which is opened
thru a preview button), I copied/pasted the exactly same chart object and put
on my Report.OnOpen event:

Private Sub Report_Open(Cancel As Integer)
Const FormName = "Graph - Form"

If Not IsLoaded(FormName) Then
DoCmd.OpenForm FormName, , , , , acDialog
End If

Graph1.RowSource = Forms(FormName).Chart1.RowSource ' The error is here
DoCmd.Close acForm, FormName
End Sub

When I try to run, I get the msg:
Run time error: 2455
You entered an expression that has an invalid reference to the property
RowSource

What can I do? I couldn't find an way around.

I know the value is getting in there because, when I change the program to
the example below, strSQL actualy receives the correct value.

strSQL = Forms(FormName).Chart1.RowSource
Graph1.RowSource = strSQL ' The error is here

I even tried to assign the value at OnActivate event, but it didn't work as
well.

Thanks for any help

Mauricio Silva
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top