在窗体上,将计算字段(最大日期)从子窗体保存到主窗体上的基础表 [英] On Form, saving calculated field (max date) from subform to underlying table on main form

查看:67
本文介绍了在窗体上,将计算字段(最大日期)从子窗体保存到主窗体上的基础表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标题为MainFrm的表单,其中包含一个名为SubFrm的子表单。 在Subfrm上,有多行数据,每行都有一个标题为DueDate的字段。

I have a form titled MainFrm with a subform titled SubFrm.  On Subfrm, there are multiple rows of data, each row with a field titled DueDate.

在MainFrm上,我有一个标题为MaxDueDate的字段,我希望数据库找到最大日期来自底层子表单(Subfrm)中的数据行。 然后,我希望MaxDueDate字段被"推送"。更新后的基础表(tblMain)

On MainFrm, I have a field titled MaxDueDate, from which I want the db to find the maximum date from the rows of data in the underlying subform (Subfrm).  I would then like the MaxDueDate field to be "pushed" to the underlying table (tblMain) after update.

我正在努力开发VBA代码来执行此操作。 任何帮助都会非常感激。 谢谢。

I am struggling with developing the VBA code to do this.  Any help would be greatly appreciate.  Thank you.

推荐答案

我通常建议不要保存最长截止日期因为它是"计算的"值。要获取子表单中的最大到期日期值,您可以尝试将未绑定的控件添加到子表单的页脚,其控制源类似于:
= Max([DueDate])

I would usually advice against saving the max due date because it is a "calculated" value. To grab the max due date value in the subform, you could try adding an unbound control to the footer of the subform with a Control Source of something like: =Max([DueDate])

要在主窗体上显示此值,可以添加一个未绑定的文本框,其控制源类似于:= [SubFrm]。[Form]![TextboxNameWithMaxControlSourceHere]

To display this value on the main form, you can add an unbound textbox with a Control Source of something like: =[SubFrm].[Form]![TextboxNameWithMaxControlSourceHere]

希望这有助于您入门......

Hope this helps get you started...


这篇关于在窗体上,将计算字段(最大日期)从子窗体保存到主窗体上的基础表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆