如何在 Access 2007 中使用 vb 更新子表单中的记录集(我收到错误 #3426)

发布于 2024-09-08 09:23:44 字数 341 浏览 8 评论 0原文

我正在尝试更新子窗体中的控件。 其实我是在计算月份数。 这是代码:(不起作用!)

 While (Not Me.Form.Recordset.EOF)
months = Round((Me.End - Me.Start) / 30, 0)
Form_FinanceSubform.[number of months] = 0
Me.[number of months] = months
Me.Form.Recordset.MoveNext
Wend

我得到的错误是:“此操作已被关联对象取消” 在 Me.Form.Recordset.MoveNext 线上

有人可以帮我吗? 谢谢!

I am trying to update a control in a subform.
Actually I am calculating the number of months.
here is the code: (which doesn't work!)

 While (Not Me.Form.Recordset.EOF)
months = Round((Me.End - Me.Start) / 30, 0)
Form_FinanceSubform.[number of months] = 0
Me.[number of months] = months
Me.Form.Recordset.MoveNext
Wend

the error i get is: "this action was cancelled by an associated object"
on the line Me.Form.Recordset.MoveNext

could someone please help me out here??
thanks!

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

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

发布评论

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

评论(1

轮廓§ 2024-09-15 09:23:44

只需将这部分代码放入表单的 BeforeUpdate 事件中即可:

months = Round((Me.End - Me.Start) / 30, 0)
Form_FinanceSubform.[number of months] = 0
Me.[number of months] = months

我确实认为您可以将代码缩短为:

Me.[number of months] = Round((Me.End - Me.Start) / 30, 0)

Just put this part of your code in the form's BeforeUpdate event:

months = Round((Me.End - Me.Start) / 30, 0)
Form_FinanceSubform.[number of months] = 0
Me.[number of months] = months

I do think you could shorten your code to this:

Me.[number of months] = Round((Me.End - Me.Start) / 30, 0)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文