|
希望不同版本access不要出现问题。anyway,具体步骤如下:
1)设计时,每个textbox都这样设置:
2)代码:
Dim bingo As Integer
Private Sub Form_Open(Cancel As Integer)
Dim ctl As Control
bingo = 0
For Each ctl In Me
If ctl.ControlType = acTextBox Then
ctl.FormatConditions(0).Modify acExpression, , "[编号] = -1"
ctl.FormatConditions(0).BackColor = vbBlue
ctl.FormatConditions(0).ForeColor = vbWhite
End If
Next ctl
End Sub
Private Sub showColor()
Dim ctl As Control
For Each ctl In Me
If ctl.ControlType = acTextBox Then
ctl.FormatConditions(0).Modify acExpression, , "[编号]=" & bingo
End If
Next ctl
End Sub
Private Sub 编号_GotFocus()
bingo = Nz([编号], -1)
showColor
End Sub
Private Sub 车辆类型_GotFocus()
bingo = Nz([编号], -1)
showColor
End Sub
一下皆为textbox的GotFocus事件,代码完全一样,从略.
[em07] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|