By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,022 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,022 IT Pros & Developers. It's quick & easy.

OnApplyFilter event works oddly

P: n/a
I woud appreciate some assitance in the following case.

I have a control in the footer of my form name sFilt.

I want to show when the filter is applied and to disappear when no
filter.

In the control source; I have '=Forms!frmCalisto!filter' and it is
visible by default. It works.

However, the show / no show does not work.

Here is what is in the event;

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 1 Then
Me.sFilt.Visible = True
Debug.Print "Filter On"

ElseIf ApplyType = 0 Then
Me.sFilt.Visible = False
Debug.Print "Filter Off"

End If
End Sub

The behavior is as follow;

When I open the form with no filter, the control sFilt doesn't show
(good).
When I apply the filter, the control sFilt will show with the filter
definition (good).
When I remove the filter, nothing basically happens (bad) and in the
debug windows, I always get 'Filter On' even if all records shows.

I have spent 2-3 hours on this. Can anybody point me in the right
direction, please.

Oct 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

sa******@hotmail.com wrote:
I woud appreciate some assitance in the following case.

I have a control in the footer of my form name sFilt.

I want to show when the filter is applied and to disappear when no
filter.

In the control source; I have '=Forms!frmCalisto!filter' and it is
visible by default. It works.

However, the show / no show does not work.

Here is what is in the event;

Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = 1 Then
Me.sFilt.Visible = True
Debug.Print "Filter On"

ElseIf ApplyType = 0 Then
Me.sFilt.Visible = False
Debug.Print "Filter Off"

End If
End Sub

The behavior is as follow;

When I open the form with no filter, the control sFilt doesn't show
(good).
When I apply the filter, the control sFilt will show with the filter
definition (good).
When I remove the filter, nothing basically happens (bad) and in the
debug windows, I always get 'Filter On' even if all records shows.

I have spent 2-3 hours on this. Can anybody point me in the right
direction, please.
If you are removing the filter via code or macro the ApplyFilter event
will not fire. If this is the case explicitly set the state of your
filter control after you remove the filter or explicitly call the
form's ApplyFilter event code, e.g. call Form_ApplyFilter(Cancel,
acShowAllRecords).

Bruce

Oct 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.