如何在重新查询后重新获得焦点 [英] How to regain field focus after requery

查看:101
本文介绍了如何在重新查询后重新获得焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个子窗体,它运行子例程来更新子窗体上字段的更新后事件的主窗体。


从子例程计算正确的值并在主窗体上写这个我必须首先在子窗体上运行一个requery。


这是在子窗体上的字段中使用的代码作为更新后事件运行

I have a subform which runs a sub routine to update the main form on an after update event of a field on the subform.

To calculate the correct value from the sub routine and write this on the main form i have to first run a requery on the subform.

Here is the code used within a field on the subform run as an after update event

展开 | 选择 | Wrap | 行号

推荐答案

您可以使用控件的SetFocus方法。

You can use the SetFocus method of the control.

展开 | 选择 | Wrap | 行号


感谢SmileyCoder,


当更新了许多字段时,会运行CalcNoOfEvents例程。


因此我不知道在CalcNoOfEvents例程中最后更新了哪个字段。


我想我可以创建一个全局文本变量来保存这些信息。

Thanks SmileyCoder,

The CalcNoOfEvents routine is run when a number of fields are updated.

Therefore i do not know what field has been last updated in the CalcNoOfEvents routine.

I guess i could create a global text variable to hold this information.

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


我没有测试过这个,但你可以试试:

I haven''t tested this, but you could try:

展开 | 选择 | Wrap | 行号


这篇关于如何在重新查询后重新获得焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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