如何获得Microsoft Access表单来刷新计算列? [英] How do you get a Microsoft Access form to refresh a computed column?

查看:111
本文介绍了如何获得Microsoft Access表单来刷新计算列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Microsoft Access表单绑定到具有计算列的链接的SQL Server表。我有一个绑定到计算列的控件。

I have a Microsoft Access form that is bound to a linked SQL Server table that has a computed column. I have a control bound to the computed column.

我已经意识到计算字段在保存记录之前无法刷新。除此之外,在保存之后刷新绑定到计算列的文本框是最好的方法。

I already realize that the computed field cannot be refreshed until AFTER a record is saved. Beyond that, what is the best way to refresh that textbox that is bound to the computed column after save.

我不想做一个me.requery(整个记录集的重新查询)。

I would prefer not to do a me.requery (a requery of the whole recordset).

有没有办法刷新一个字段?

Is there a way to JUST refresh that one field?

谢谢。
Seth

Thanks. Seth

推荐答案

为澄清而编辑:实际上有几个策略要考虑。

Form.Refresh()将刷新您的Form的记录源,捕获对现有记录的修改和删除,并保留在当前记录上。但是,您打开表单后,您将看不到任何新记录。

Form.Refresh() will refresh your Form's recordsource capturing modifications and deletions to existing records and will stay positioned on the current record. However, you would not see any NEW records that were added since you opened your form.

Form.Requery()将重新运行Form的记录源查询。您将看到所有的Form.Refresh()更改,它将显示任何新的记录。在UI上,Form.Requery()重新定位到第一条记录。

Form.Requery() will re-run the Form's recordsource query. You will see all the Form.Refresh() changes AND it will show you any new records. On the UI, Form.Requery() repositions to the first record.

Form.Control.Requery()类似于Form.Refresh (),因为您不会更改记录位置或查看新记录。它将更新您的控制,假设控件基于查询/表。

Form.Control.Requery() is similar to Form.Refresh() in that you will not change record position or see NEW records. It will update your control, assuming the control is based on a query/table.

您需要确保触发事件涉及数据库更新。可能有一些控件的AfterUpdate()在数据库I / O之前的情况,这不会帮助你。

You'll need to be sure that the triggering event involves a database update. There can be cases where the control's AfterUpdate() precedes database I/O, which wouldn't help you.

这篇关于如何获得Microsoft Access表单来刷新计算列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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