如何在 Access 表单中重新绘制 Microsoft Chart

发布于 2024-10-24 08:37:34 字数 430 浏览 10 评论 0原文

我有一个子表单,它在其表单中设置Microsoft Chart 5.0对象的RowSource。

编辑:图表的行源类型是值列表。

然而,该图形不会自行绘制,但任何通常会生成重绘的操作(将另一个 Access 窗口拖到其上、将其最小化、有时会丢失和重新获得焦点)确实会重绘它。换句话说,图表不会自动显示或更改。

如何在子表单操作后强制重新绘制图表?

这些没有效果:

parent.Referesh
parent.Repaint
parent.TheChart.Refresh

不幸的是,这似乎不存在:

parent.TheChart.Repaint

使用:Access 2003

I have a subform which sets the RowSource of a Microsoft Chart 5.0 object in its parent form.

EDIT: The Row Source Type for the graph is Value List.

The graph does not paint itself, however, but any action which would generally generate a repaint (drag another Access window over it, minimize it, loss and regain of focus sometimes) does indeed repaint it. In other words, the graph doesn't show or change automatically.

How do I force a repaint of the chart after a subform action?

These have had no effect:

parent.Referesh
parent.Repaint
parent.TheChart.Refresh

And this does not seem to exist, unfortunately:

parent.TheChart.Repaint

Using: Access 2003

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我ぃ本無心為│何有愛 2024-10-31 08:37:34

问题不在于重新绘制图表。最有可能的是,您正在使用的子表单正在从查询或表中检索数据。

您必须更新“数据源”对象上的值,该对象提供子表单数据(查询或表)。然后,在主窗体中重新查询图形对象。

我在 MS-Acess 2000 中做了一个非常简单的示例,效果非常好:

  • 一个包含三列(frt_idfrt_name)的表(t01_fruits) ,frt_qty)。
  • 基于 t01 表的子表单。
  • 一个主窗体,其中包含先前的子窗体,一个基于表 t01_fruits 的饼图和一个按钮。在按钮的 OnClick 事件中,我只放置了 me.graph1.requery

当我更新主窗体内子窗体中的水果数量时,图表没有任何反应。当我单击该按钮时,图表会正确更新。

The problem isn't the repainting of the graph. Most likely, the subform that you are using is retrieving data from a query or table.

You must update the values on the "datasource" object, which is providing the subform data (either a query or a table). Then, re-query the graph object in the mainform.

I made a very simple example in my MS-Acess 2000 and it worked great:

  • A table (t01_fruits) with three columns (frt_id, frt_name, frt_qty).
  • A subform based in the t01 table.
  • A mainform with the previous subform inside, a pie-chart based on table t01_fruits and a button. In the OnClick event of the button, I put just me.graph1.requery.

When I update the fruits quantity in subform, inside mainform, nothing happens with the graph. When I click the button, the graph is updated correctly.

长途伴 2024-10-31 08:37:34

更新表单信息后刷新图表时我也遇到了同样的问题。我通过在更新链接到数据更改的收件箱后重新查询图表来解决这个问题。

 Private Sub txtFinAgreeEnacDt_BeforeUpdate(Cancel As Integer)
    Me.graphCRMStatus.Requery
 end sub  


 Private Sub txtFinAgreeEnacDt_AfterUpdate()
     Me.Requery
 End Sub

我是持有图表的表格......

I also faced same problem in refreshing chart after updating information in form. I got it resolved by re-queering the chart after update of the inbox linking to change of data.

 Private Sub txtFinAgreeEnacDt_BeforeUpdate(Cancel As Integer)
    Me.graphCRMStatus.Requery
 end sub  


 Private Sub txtFinAgreeEnacDt_AfterUpdate()
     Me.Requery
 End Sub

Me is the Form holding graph....

迷爱 2024-10-31 08:37:34

我遇到了类似的问题,主页带有子表单,包括 2 个带有图形的页面 - 刷新它的解决方案如下:

me.subForm.Requery
me.subForm!Graph1.Requery

只有当您按此顺序执行命令时,它才会正确更新图形。

我知道自提出问题以来已经有一段时间了,但以防万一其他人也遇到这样的问题。

I had similar problem like this, having main page with sub-forms, including 2 with graphs - and solution to refresh it was like this:

me.subForm.Requery
me.subForm!Graph1.Requery

Only when you execute commands in this order, it would update graph properly.

I know it's been a while since question was asked, but in case anyone else has issue like this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文