简体   繁体   中英

MS Access 2003/2007 - Chart Object on a sub form, not loading when parent forms load

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

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

I have looked around for this problem and found that me.graph1.requery doesn't help in my 2003 version. I did try in desperation this: docmd.requery (Graph1) that crashes but when you put on error resume next it does show the graph everytime! True Microsoft style I guess to fix it with another buggy thing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM