Report based on a filtered form

Y

Yanick

I need one of my report to show exactly the same records as one of my
subform. I created a button doing this (which is working) :

DoCmd.OpenReport "00-GetOutstandingSalesOrder", acViewPreview, ,
Form_CustomerOutstandingSalesSubForm.Filter

The problem is if I close my report and remove all filter on the subform
then click the button again, the last filter is still apply on my report.
Would like to see all record if there is no filter apply.

My Subform is in datasheet view which I filter using the filters toolbar
button. I also have a report based on the exact same record source then my
subform.

Any suggestion?
 
M

Marshall Barton

Yanick said:
I need one of my report to show exactly the same records as one of my
subform. I created a button doing this (which is working) :

DoCmd.OpenReport "00-GetOutstandingSalesOrder", acViewPreview, ,
Form_CustomerOutstandingSalesSubForm.Filter

The problem is if I close my report and remove all filter on the subform
then click the button again, the last filter is still apply on my report.
Would like to see all record if there is no filter apply.

My Subform is in datasheet view which I filter using the filters toolbar
button. I also have a report based on the exact same record source then my
subform.


You should not use the Form_ syntax except when creating
multiple instances of the same form. Instead, assuming the
name of the subform **control** is named the same as the
form object it displays, use:

With Me.CustomerOutstandingSalesSubForm.Form
DoCmd.OpenReport "00-GetOutstandingSalesOrder", _
acViewPreview, , IIf(.FilterOn, .Filter, "")
End With
 
D

Dale Fye

Marshall,

What is your reason for advising Yanick not to use the "Form_" syntax of
refering to filter property of a form? Is this recommendation specific to
this instance or is there something else involved with this syntax that we
should all know about?

I've been using the Form_FormName.control for quite some time and have not
experienced any unforseen circumstances (at least none that I'm aware of).
The advantage of using that syntax is that you get intellisense.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top