如何使用控件源并添加表达式? [英] How to use a control source and add an expression?

查看:57
本文介绍了如何使用控件源并添加表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个用于训练的数据库,我希望能够在一个表单中的字段上有一个控制源以及该字段的表达式,使用的表达式是DateAdd(" interval,数,[领域)。我希望能够在一个字段中输入一个发布日期,并让它自动将到期时间添加到其他字段以及查询和表格。

I am building a data base for training, I want to be able to have a control source on a field in a form along with an expression for the field,The expression im using is "DateAdd("interval",Number,[Field]). I want to be able to type in a issue date in one field and have it automatically add the expiry to the other field as well as the query and table.

推荐答案

将.DefaultValue设置为所需的公式。您也可以在第一个控件的AfterUpdate事件过程中再次设置它。
Set the .DefaultValue to the formula you want. You can also set it again in an AfterUpdate event procedure of the first control.


更改DefaultValue后,问题字段中输入的数据仍然不会计算到Expiry字段,并添加到AfterUpdate
The Data Entered in the Issue Field still does not calculate onto the Expiry field after changing the DefaultValue, and adding to AfterUpdate


rudycortez2:

您是否需要存储过期日期?

可以使用计算字段查询(或未绑定的控件),以便根据需要计算日期。
rudycortez2:
Is there some reason you need to store the expry date?
One can use a calculated field in a query (or an unbound control) to, well, calculate the date upon demand.


这篇关于如何使用控件源并添加表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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