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

Trying to make a filtered report 1

Status
Not open for further replies.

ChrisTheAncient

Technical User
Dec 22, 2002
169
GB

I'm not sure if this can be done?

I have created a customer database that is in both Access XP and A97

There is the main table - Customer Database.

There are data forms based on dynasets of:

*CustomerDatabase
*ActiveCustomers
*InactiveCustomers
*FinishedCustomers

And they all work the way I want.

I have created a 'generic' report (ReportOnACustomer) that I want any of the data forms to be able to call up at the click of a button - and at the moment it works on the CustomerDatabase form quite nicely.

However, none of the other forms can call up the same report properly because of the way the report properties filter is constructed...

(CustomerNumber = forms!CustomerDatabase!CustomerNumber)

I have tried various combinations of Me. in the filter property with no suucess. This could be my ineptitude!

Is there a way of making this filter 'volatile' or will I have to bite the bullet and make copies of the report for each of the dynasets (gulp)?

TIA

Chris

*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
You are using the filter property of the report?

In "generic" reports I either use the where condition when opening the report (from the calling form) or I've used a public variable (fetched thru a public function) as criteria in the query.

Would any of those apply to your situation?

Else, you should also be able to use the on open event of the report to set the filter programatically. The openargs argument/property might be used to send and set the filter.

Roy-Vidar
 

Roy-Vidar

I think I know what you mean! But it will probably be stretching my abilities somewhat. My vba is quite limited.

I started this particular phase of the project quite a while back, so I can't really remember how that line got into the properties of the report in the first place! I probably plagiarised the idea from somewhere else - that's where I get most of my code from!

Any ideas that work at idiot level?

Chris

*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Last suggestion, everywhere you call the report (from all the forms) alter the openline so you send the openargs:

[tt]docmd.openreport "rpt",acVievPreview,,,,Me!txtNum.Value[/tt]

- where Me!txtNum represents the control holding the customer number.

Then in the reports on open event:

[tt]if not isnull(me.openargs) then
me.filter = "CustomerNumber = " & me.openargs
me.filteron=true
end if[/tt]

- haven't tested it on 97 yet, but works on XP

Roy-Vidar
 

Roy-Vidar

I shall try that - but someone now needs to force an evening meal down my throat before she gives it to the cat!

And as a glass of vino collapso will go with it (and it's late here in the UK) the evening will be gone.

So I shan't be able to give it a go until tomorrow afternoon, but now I can see where it's going, I'm now a lot more confident.

So, you get the star for the help - and the speed of it! And I shall try and report back in about 18 hours.

Thanks for the guidance - and I'm looking forward to trying it.

Chris

*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 

OK, folks. It's time for Chris to hold his hands up and admit he mucked up - big time!

For those who followed the thread - especially Roy-Vidar - I confess all.

My problems came because when my forms were 'downgraded' from XP to 97, some of my whizzy bits wouldn't work. So I made one form work properly in 97 and then made copies and modified them for the other forms.

And guess which idiot didn't check his code in the forms thoroughly - thus causing all his problems, heartache and hair tearing out. A check today - after a night's sleep and a day's work, showed I had been less than thorough in my referencing. How do you think I feel? Got it in one!

I shall go and stand in the corner - facing the wall and sucking my thumb - reciting, "I must check my code thoroughly at all times!"

Aplogies for wasting your time - but thanks for trying to help.

Chris


*************************************
OK, I'm stoopid. But I'm good at it!
*************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top