Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear report filter

Status
Not open for further replies.

bradles

Technical User
Sep 15, 2002
110
AU
Must be missing something simple,

Using a popup date form to return a date and hoping to filter a report's data accordingly. Now this works when opening the report and using the WhereCondition property of OpenReport, but for the life of me I can't seem to clear the report filter before adding the new date.

I've tried:
- RPT.FilterOn=False
- RPT.Filter="" and combinations of turining the filter on/off and trying to clear it.

Any ideas?
 
Hello, I rarely use the where condition for filtering a report but it would seem to me that if you close the report, change the dates and open the report that you would be seeing new data.

So, you might check to see that your 'where' condition is structured correctly.

As a means of checking, you could try placing the date criteria in the report's underlying query:

Query Criteria for date field: =forms!frmPopUP.txtDate1

Try running that without the 'Where' statement.

Hope that helps
 
Thanks dRahme,

I'm already working around the problem by closing and opening the form with a new filter as you've suggested and it looks very ugly. Hoping to just refilter the report without going to the overhead of altering the RowSource query and I thought it would be simple.

I'll try setting a hidden report control to the date value and setting a permanent filter to that and get back to you.....
 
After the filter change(s)
have you tried any of the "re"s??
repaint
requery
refresh
Just a thought...

---------------------------------------
The customer may not always be right, but the customer is ALWAYS the customer.
 
Good thinking NorthNone, but it seems if I attempt to change the filter all it does is concantate the new filter. I just can't seem to clear it.
 
Hi, it almost sounds like you are trying to print a report based on a filtered form. It that is the case, you might find this helpful:

Private Sub Report_Open(Cancel As Integer)

Me.FilterOn = False
Me.OrderByOn = False



Dim frm As Form

If (CurrentProject.AllForms("frmPrintAnything").IsLoaded) Then
Set frm = Forms("frmPrintAnything")

Me.RecordSource = frm.RecordSource

If (frm.FilterOn) Then
Me.Filter = frm.Filter
Me.FilterOn = True
End If


End If
End Sub

dRahme
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top