设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

access获取当前窗体焦点所在的控件位置

2015-4-13 17:12| 发布者: admin| 查看: 2371| 评论: 3|原作者: 大熊|来自: www.office-cn.net

摘要: 可用局部变量在GETFOCUS里刷新。也可通过代码Screen来获取

获得窗体/焦点控件信息

用screen,下面为帮助里的原代码,还是帮助好用
Sub ActiveObjects()
    Dim frm As Form, ctl As Control

    ' 返回指向活动窗体的 Form 对象。
    Set frm = Screen.ActiveForm
    MsgBox frm.Name & " is the active form."
    ' 返回指向活动控件的 Control 对象。
    Set ctl = Screen.ActiveControl
    MsgBox ctl.Name & " is the active control " _
        & "on this form."
End Sub
发表评论

最新评论

引用 浪上飞郑 2002-10-12 06:19
用screen,下面为帮助里的原代码,还是帮助好用
Sub ActiveObjects()
    Dim frm As Form, ctl As Control

    ' 返回指向活动窗体的 Form 对象。
    Set frm = Screen.ActiveForm
    MsgBox frm.Name & " is the active form."
    ' 返回指向活动控件的 Control 对象。
    Set ctl = Screen.ActiveControl
    MsgBox ctl.Name & " is the active control " _
        & "on this form."
End Sub


[此贴子已经被作者于2002-10-11 22:19:16编辑过]

引用 兔子罗杰 2003-8-12 04:49
好东西,谢了!
引用 zhu320211 2012-7-14 10:36
浪上飞郑 发表于 2002-10-12 06:19
用screen,下面为帮助里的原代码,还是帮助好用
Sub ActiveObjects()
    Dim frm As Form, ctl As Contro ...

这段代码怎么用,老是弹出“你输入的表达式需要控件在活动窗口中”

查看全部评论(3)

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-3-29 00:49 , Processed in 0.068838 second(s), 23 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部