满足条件,改变记录的显示特征
时 间:2015-01-03 21:48:47
作 者:吴俊锋 ID:36923 城市:无锡
摘 要:遇到一个问题,不知道大家是否遇到过。
实现如下的目标,部门为某值时,记录背景显示黄色。功能是实现了,但是出来之后屏幕一直在闪烁。
正 文:
遇到一个问题,不知道大家是否遇到过。
实现如下的目标,部门为某值时,记录背景显示黄色。功能是实现了,但是出来之后屏幕一直在闪烁。


Private Sub Form_Open(Cancel As Integer)
setbackcolor Me.Form, "bm='设计一所' "
End Sub
Private Function setbackcolor(frm As Form, tj As String) As Boolean ‘该函数设置记录特性,从网络中获取,非常感谢!
Dim intCount As Integer
Dim ctl As Control
Dim fcd As FormatCondition
For Each ctl In frm.Controls
If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
intCount = 0
ctl.FormatConditions.Delete
ctl.FormatConditions.Add acExpression, acEqual, tj
Set fcd = ctl.FormatConditions.Item(intCount)
With fcd
.BackColor = vbYellow '背景黄色 65535
.ForeColor = vbBlack '前景色黑色
' .FontUnderline = True '加下划线
.FontBold = True '加黑
' .FontItalic = True '斜体
End With
End If
Next ctl
setbackcolor = True
Set ctl = Nothing
Set fcd = Nothing
End Function
实现如下的目标,部门为某值时,记录背景显示黄色。功能是实现了,但是出来之后屏幕一直在闪烁。


Private Sub Form_Open(Cancel As Integer)
setbackcolor Me.Form, "bm='设计一所' "
End Sub
Private Function setbackcolor(frm As Form, tj As String) As Boolean ‘该函数设置记录特性,从网络中获取,非常感谢!
Dim intCount As Integer
Dim ctl As Control
Dim fcd As FormatCondition
For Each ctl In frm.Controls
If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
intCount = 0
ctl.FormatConditions.Delete
ctl.FormatConditions.Add acExpression, acEqual, tj
Set fcd = ctl.FormatConditions.Item(intCount)
With fcd
.BackColor = vbYellow '背景黄色 65535
.ForeColor = vbBlack '前景色黑色
' .FontUnderline = True '加下划线
.FontBold = True '加黑
' .FontItalic = True '斜体
End With
End If
Next ctl
setbackcolor = True
Set ctl = Nothing
Set fcd = Nothing
End Function
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access自定义消息盒Msg...(04.28)
- Access怎么按每个月份里面...(03.09)
- Access怎么按季度来统计人...(02.26)
- Access怎么按年龄段来统计...(01.26)
- 【Access高效办公】上一年...(12.29)
- 用Access连续窗体制作的树...(11.03)
- 【Access高效办公】上一年...(10.30)
- Access制作的RGB转CM...(09.22)
- Access制作的RGB调色板...(09.15)
学习心得
最新文章
- 用VBA批量更改SQL SERVE...(05.30)
- 用SQL代码更改SQL Serve...(05.29)
- Access快速开发平台--图片附...(05.29)
- 如何用VBA检查表有没有设置主键(05.28)
- 用VBA来指定图表中横坐标/纵坐标...(05.25)
- 还在凭感觉建表?Access建表思...(05.25)
- ACCESS视频手机上看瞎眼?用电...(05.24)
- 用SSMS将ACCESS中的表导入...(05.21)
- 自动编号用不好,系统迟早要乱!Ac...(05.21)
- Access原生开发VS快速开发:...(05.20)


.gif)
