如何将文本框中的计算值保存到表格中 [英] How to save calculated value from textbox in to the table

查看:80
本文介绍了如何将文本框中的计算值保存到表格中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将文本框中的计算值保存到表格中?我试图将我的计算作为默认值,它正在保存,但如果我更改输入,我的计算不会改变.如果我把它放到我的控制源中,我就无法保存它.

How can i save a calculated value from textbox in to the table? I tried to make my calculation as the default value, it's saving but if i change the input my calculation doesn't change. If i put it to into my Control Source i can't save it than.

是否可以将计算保存到表格中?

Is it possible to save the calculation in to the table?

亲切的问候,卢克索

推荐答案

在大多数情况下,您需要使用事件.控件的 After Update 事件通常是合适的.例如

For the most part, you need to use an event. The After Update event of a control is usually suitable. For example

 Form
 ---------------------------
 Amount : 10
 Tax    :  2
 Total  : 12  'Amount + Tax

使用上面的表单,在税和金额的更新后事件中,您可以将绑定控件总计更新为金额+税.

With the above form, in the After Update event for Tax and for Amount, you could update the bound control Total to Amount + Tax.

Private Sub Amount_AfterUpdate()
    Me.Total = Me.Amount + Me.Tax
End Sub

与计算一样,您必须问自己是否与存储此计算相关,还是可以从查询中获取?

As usual with calculations, you must ask yourself is it relevant to store this calculation or can it be obtained from a query?

最后,Access 2010 带来了数据宏计算列,这也可能适用.

Finally, with Access 2010 came data macros and calculated columns, which may also suit.

这篇关于如何将文本框中的计算值保存到表格中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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