VBA打开一个表格,想要设置焦点,感觉就像一切都已经尝试过 [英] VBA opening a form, want to set focus, feels like everything have been tried out

查看:331
本文介绍了VBA打开一个表格,想要设置焦点,感觉就像一切都已经尝试过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


感谢您阅读本文:)


我的表格A由主表格A和A组成子表单A.


在子表单A中,我有一个可以双击的字段。然后,主窗体B打开一个搜索字段。子表单B具有作为记录集的查询。查询使用搜索字段值作为过滤器,每次将文本输入搜索字段时都会更新过滤器。


我想要发生的是将重点放在搜索上字段b一旦打开就打开。我试过这段代码。

Hi All,

Thanks for reading this :)

I have a form A that consists of a main form A and a sub form A.

In sub form A, I have a field which I can double click. Then, Main form B opens up with a search field. Sub form B has a query as recordset. The query use the search field value as a filter, and the filter is updated every time text is entered into the search field.

What I want to happen is to set focus on the search field once form b is opened. I have tried this code.

展开 | 选择 | Wrap | 行号

推荐答案

如果我没记错的话,你有将焦点设置为第一个,然后将焦点设置为表单A上的对象。


Jim
If I remember correctly, you have to set the focus to form A first, then set the focus to an object on Form A.

Jim


@jimatqsi


嘿Jim,


谢谢你看看在这个。


我的目标是将注意力集中在表格B上的一个对象上。


如果我说你建议,我是否理解你


1.将焦点设置为表格B

2.将焦点放在表格B上的对象上


I试过这段代码
@jimatqsi
Hey Jim,

Thanks for having a look on this.

My goal is to set focus on a object on Form B.

Do I understand you correctly if I say you suggest

1. Set focus to Form B
2. Set focus on an object on Form B

I tried this code
展开 | 选择 | Wrap | 行号


在我看来你说得对,除了......你正在打开表格B和然后将焦点设置在表格B(它已经是)上,然后将焦点设置为表格B上的对象。


不应该是第3行和第4行请参阅另一种形式,表格A?


Jim
It looks to me like you got it right, except ... you are opening Form B and then setting the focus on Form B (where it already is) and then setting focus to an object on Form B.

Shouldn''t lines 3 and 4 refer to a different form, Form A?

Jim


这篇关于VBA打开一个表格,想要设置焦点,感觉就像一切都已经尝试过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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