Rabu, 03 Oktober 2012

[MS_AccessPros] Clearing filter not working

 

Hi All! Long time no see because you've equipped me so I've been solving my problems!!! Thank you!

I have a clear button with code below that is supposed to clear the controls on a continuous form and set the filter to "". When this continuous form is filtered and then reset using this button it appears to work and shows all the records. But when I press the Print button, the records that show up on the report are still filtered with the old filter.

When I step put a stop in the code and step through it, at the end Me.Filter = "" when I hover over it and when I use the Immediate window and type ?Me.Filter the result is nothing. But the Filter in Data tab of the Properties Sheet still shows the old filter and the FilterOnLoad is No.

So even though it appears when stepping through the code that Me.Filter has been reset to "", the Properties Sheet still shows the old filter.

Crazy! But I'm guessing you'll shed light on this :-)

Thanks!
Connie

Private Sub cmdReset_Click()
On Error GoTo Proc_Err
'Purpose: Clear all the search boxes in the Form Header, and show all records again.
Dim ctl As Control

'Clear all the controls in the Form Header section.
For Each ctl In Me.Section(acHeader).Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox
ctl.Value = Null
Case acCheckBox
ctl.Value = False
Case acListBox
If (ctl.MultiSelect = 0) Then
' Values of the multiselect property:
' 0 – None
' 1 – Simple
' 2 – Extended
ctl.Value = Null
Else
ctl.RowSource = ctl.RowSource
' Found in TheAceMan1's faq, thanx
End If
End Select
Next

' If a filter currently applied,
If Me.Filter = "" Or Me.Filter = Null Then
If Me.OrderByOn = False Then Me.OrderByOn = True
Me.OrderBy = "ActivityDate, TrackingActID"
Exit Sub
Else:
' Remove the old filter
Me.Filter = ""
Me.FilterOn = False
End If

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar