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!

Filtered Records of a form = Records of a Report? 1

Status
Not open for further replies.
Aug 10, 2001
15
0
0
AT
Is it possible to use the filtered records of a form as the records to appear in a Report, and this without saving the filter as query?
There are sbout 50 fields in the form and I don't want to go through a query that does forms![My form].[Myfield] for each of the 50 fields.

Please help !
 
Hi!

Base your report on the same table as the form. On the form put a command button to open the report. In the Click event of the command button use the following code:

DoCmd.OpenReport "YourReportName", acViewPreview, Me.Filter

This will open the report in preview using the same filter that has been applied to the form.

hth
Jeff Bridgham
 
Hi and thank you, jebry, the problem is, I am doing something wrong, because it does not work. I made a button like you said, clicked on the button in the form based on a query, I opened the report (based on the same query) and I got the unfiltered records.

Another help? Thanks in advance

 
Hi!

I'm sorry about that first suggestion. I thought Access created a filter when it filtered by form. By the way, is that what you are doing? If you are using filter by form, I think you can access the filter from the Me.Filter property as shown before, in the ApplyFilter event, which actually runs before Access applies the filter and redisplays the form. Maybe you can run the report from that event, or, maybe you can capture the filter in that event and store it in a form level variable, which can be used in the button's click event.

I haven't tried these methods, so let me know how they work!

Thanks and sorry again about making a bad assumption!
Jeff Bridgham
 
Hey, what a hint!!!

After using filter by form, the button opens the report, which,in the Event On Open runs the Macro AppyFilter with =Forms![My form].Filter as condition. This is it!

I hope my english is understandable. My Access is the German Version.

Thanks again for the hint
 
Hi!

Glad it worked out! I'm going to have to print this out so I remember it in the future! By the way, your English is very understandable, undoubtably better than my German!
:)

Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top