How to highlight "Filter by Section" field
Access has ApplyFilter Event, which helps us to do this. Here a sample code, which changes border of ActiveControl to red and other controls to default color. And when you remove filter – it will set all controls border color to default.
Private Sub Form_ApplyFilter(Cancel As Integer, _
ApplyType As Integer)
Dim ctl As Access.Control, _
strActiveControl As String
If ApplyType = 1 Then 'Apply filter
strActiveControl = Screen.ActiveControl.Name
End If
If Len(strActiveControl) > 0 Then
Me(strActiveControl).BorderColor = vbRed
End If
For Each ctl In Me.Controls
Select Case TypeName(ctl)
Case "TextBox", "Combobox"
If ctl.Name <> strActiveControl Then
ctl.BorderColor = 8421504
End If
End Select
Next ctl
End Sub
You can extend it by highlighting all controls, participating in filtering, when you apply filter several times.
1 Comments:
perhaps you getting this error when you debugging your code? Then you have to put stop after line:
strActiveControl = Screen.ActiveControl.Name
Post a Comment
<< Home