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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change a Report FilterOn property 2

Status
Not open for further replies.

M8KWR1

IS-IT--Management
Dec 8, 2008
20
0
0
GB
Is there a way to change the filterOn property of a report before i run the report, via some vba.

I know i can do this within the report, but i am using some code to export this to a PDF document - and it does not hit the report_load procedure.

As default the report has a filter setup, but i just want to turn this off - if possible via come code.

I am trying to get around having to have 2 reports that are the same.

Many thanks
 
How are ya M8KWR1 . . .

Have a look at the [blue]DoCmd.OpenReport[/blue] Method. Example:
Code:
[blue]   DoCmd.OpenReport "[purple][B][I]ReportName[/I][/B][/purple]", acViewPreview, , "[Name] Like '*I*'"[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I can not set the filter on the report that way...

The code i am using for the pdf file, just needs the report name, and nothing else!!!!

So i was kind of wondering if there was a way to over-ride if the report uses the filterOn or not...

As default the report use FilterOn, and i have set a Filter etc.

But i just need to turn it off without having to actually call the report.. if you get what i mean...
 
M8KWR1 . . .

Ohhh ... I see. In that case you can force the change in [blue]design view[/blue]:
Code:
[blue]   Dim Nam As String
   
   Nam = "[purple][B][I]YourReportName[/I][/B][/purple]"
   
   DoCmd.OpenReport Nam, acViewDesign
   Reports(Nam).FilterOn = False
   DoCmd.Close acReport, Nam, acSaveYes[/blue]
[blue]Your Thoughts? . . .[/blue]

BTW: Welcome to [blue]Tek-Tips![/blue] [thumbsup2] Do have a look at one of the links at the bottom of my post. The links will help you [blue]ask better questions[/blue], get [blue]quick responses[/blue], [blue]better answers[/blue], and insite into [blue]etiquette[/blue] here in the forums. Again . . . Welcome to [blue]Tek-Tips![/blue] [thumbsup2] [blue]Its Worthy Reading![/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Aceman many thanks

the only things that was wrong in your code was i had to use FilterOnLoad.... but thanks for pointing me in the right direction...

EXCELLENT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top