Clearing the filter form

  • Thread starter Thread starter Leigh
  • Start date Start date
L

Leigh

Guest
When you click the "Filter By Form" button, the criteria form is displayed, but it usually remembers the last filter. I would like to always display the filter form with NO criteria displayed.

Access help says I should set the Filter property of the form to "" in the OnFilter event of the form to accomplish this. It does clear the Filter, but not the Filter Form.

I don't know if this would make a difference or not, but the form's AllowEdits is set to False by default.

Anyone have any suggestions on solving this problem?

Thanks!

[This message has been edited by Leigh (edited 12-05-2000).]
 
Leigh,
Give this a try, I think I found it here, some time ago.
============================================
Private Function ClearForm(frmName As String)

' Resets / Clears controls on the specified form

Dim F As Form, ctl As Control
Set F = Forms(frmName)
On Error Resume Next
For Each ctl In F.Controls
Select Case ctl.ControlType
Case acTextBox, acListBox, acOptionGroup, acComboBox:
ctl = Null
End Select
Next ctl
End Function
===========================================

ClearForm (your form name)

===========================================

I use it a lot, works well.

Skip


[This message has been edited by skiphooper (edited 12-01-2000).]
 

Users who are viewing this thread

Back
Top Bottom