views:

124

answers:

1

SO I have a subform, that simply has one chart object on it. Its small, and this is the only purpose of this sub. Then I have about 10 forms that each have a sub windows with this form as it's child. I use a UNION query to show the current balance of 10 accounts on each form with this chart for comparative purposes. Everything works fine except for one small thing...

when you open any of these forms, you have to take your mouse over to the actual sub window and click inside of it to get the chart to show. once you do it works fine, on any and all forms, but this same issue if recurring on all these forms as well, so I am sure I am missing something here??

Any ideas about this one?

thanks Justin

+1  A: 

I think you can work this out by not using a subform, but rather a chart control directly inserted in the form. I know it can be a headache to design a chart control in every form, but by doing it, you can control directly the data source of the chart independently from any other form.

Example:

I will suppose that you need to update the chart after updating a text box (txtExample). You can alter the data source of the control usint the afterUpdate event:

Private Sub txtExample_AfterUpdate()
  chart1.RowSource = "SELECT ... FROM ..." 
  chart1.Requery
End Sub

The RowSource property of the chart object will be altered and updated every time the value of the text box is updated.

Hope this works for you

Barranka
Which version of MS-Graph is it that allows dynamic assignment of the SQL? I haven't mucked about with MS-Graph for well over 10 years, but one of the issues with it was that it wasn't easy to change the SQL at runtime so that you often had to edit a saved QueryDef in order to change the data the chart was based on. But, of course -- I could be misremembering, or newer versions of MS-Graph allow more flexibility.
David-W-Fenton
@David...well I am not sure about all versions that allow it, but I know you can with 2003, and probably 2007 as well. I have a bunch of reports with charts that use the above method (sort of) values from a form are passed to the rowsource and when the reports are opened. I was just hoping that I could get it done differently with this because it is essentially the exact same chart on all these forms so I made a sub form with a chart to save myself some effort. but given that it is only about 10 forms, I guess I can go this route. I use the .rowsource method above on those reports though...
Justin