设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1240|回复: 3

[窗体] 请教!有没有历遍所有控件的函数?

[复制链接]
发表于 2019-4-30 16:52:58 | 显示全部楼层 |阅读模式
例如,要把窗体中所有标签的字体颜色改为红色?
发表于 2019-5-2 08:52:50 | 显示全部楼层
本帖最后由 zyp 于 2019-5-2 08:54 编辑

dim myCtl as Control
For Each myCtl In Me.controls
    if myCtl.ControlType=acLabel Then
         myCtl.ForeColoer=vbRed
    end if
Next myCtl
 楼主| 发表于 2019-5-2 11:21:33 | 显示全部楼层
zyp 发表于 2019-5-2 08:52
dim myCtl as Control
For Each myCtl In Me.controls
    if myCtl.ControlType=acLabel Then

谢谢您的关注!
运行时报错:
运行时错误'438',对象不支持该属性或方法,
在这一行:myCtl.ForeColoer = vbRed
 楼主| 发表于 2019-5-2 11:30:34 | 显示全部楼层
好了  改成:myCtl.ForeColor = vbRed
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-3-28 22:25 , Processed in 0.092192 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表