[英]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.
然后,我有大约10个表单,每个表单都有一个子窗口,该窗口是它的子窗口。 I use a UNION query to show the current balance of 10 accounts on each form with this chart for comparative purposes.
为了进行比较,我使用UNION查询在此表格上显示每个表格上10个帐户的当前余额。 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). 我假设您需要在更新文本框(txtExample)之后更新图表。 You can alter the data source of the control usint the
afterUpdate
event: 您可以使用
afterUpdate
事件来更改控件的数据源:
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. 每次更新文本框的值时,图表对象的
RowSource
属性都会更改和更新。
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. 我到处寻找这个问题,发现
me.graph1.requery
在我的2003版本中无济于事。 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! 我确实在无奈
docmd.requery (Graph1)
尝试了此操作:崩溃的docmd.requery (Graph1)
,但是当您放下on error resume next
它每次都会显示图! True Microsoft style I guess to fix it with another buggy thing. 真正的Microsoft风格,我想用另一个有问题的东西来修复它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.