Viewing a report of filtered resutls using a Command Button.

  • Thread starter Thread starter Grace
  • Start date Start date
G

Grace

I have the following fields in a table called Names:

First Name; Last Name

I have a form I use for entry purposes that has the two mentioned fields and
a command button

I have a report entitled - Names

The command button allows me to preview the Names report after filtering
using the built in access filter.

Once I create a filter, all works great. However, what is best way to remove
the filtered results so that I can view all unfiltered records?
Any assistance is greatly appreciated.

My code for the command button is:


If Not IsNull(Me.Filter) Then
DoCmd.OpenReport "Names", A_PREVIEW, , Me.Form.Filter
DoCmd.Maximize 'Maximize the report window.
Else
MsgBox "Apply a filter to the form first"
End If
 
Hello Grace.
I have the following fields in a table called Names:

First Name; Last Name

I have a form I use for entry purposes that has the two mentioned
fields and a command button

I have a report entitled - Names

The command button allows me to preview the Names report after
filtering using the built in access filter.

Once I create a filter, all works great. However, what is best way
to remove the filtered results so that I can view all unfiltered
records?
Any assistance is greatly appreciated.

My code for the command button is:


If Not IsNull(Me.Filter) Then
DoCmd.OpenReport "Names", A_PREVIEW, , Me.Form.Filter
DoCmd.Maximize 'Maximize the report window.
Else
MsgBox "Apply a filter to the form first"
End If

You could create another Button executing the following code:
DoCmd.OpenReport "Names", acViewPreview
DoCmd.Maximize 'Maximize the report window.
 
Wolfgang:

Thanks for reply.

Your suggested code just opens the same filtered report that the first
button opens. I need a command button that, when clicked, will just clear
all filtered results.


Any further suggestions are appreciated.

Grace
 
Hello Grace.
Your suggested code just opens the same filtered report that the
first button opens. I need a command button that, when clicked,
will just clear all filtered results.

My code does not specify a filter.
If my code opens a filtered report, then the query the report is
based on contains filter criteria. Or maybe there is a filter stored
in the report. Open the report in design view and clear the filter
property in the data properties of the report.
 
Back
Top