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

Applying filter from form to report

Status
Not open for further replies.

bahs

Programmer
Mar 3, 2001
10
US
I need to do something very simple (or so it seems to me). I have a form with a matching report. On my form I have a button to print the report. I only want the report to print the data on my form as I restrict it with a FILTER (while on the form). I always set the filter such that only ONE row qualifies and I only want that one row to print on my report.

I can't get the report to recognize the filter as set on the form. The form recognizes it. In my report properties I've set the filter option to 'yes'.

I'm sure this is simple... I've searched help in Access and the resources of this forum.... no luck... can someone please tell me what I'm doing wrong?
 
Here is what I do...
DoCmd.OpenReport stDocName, acNormal, , "" & lcWhere & "".

lcWhere is a string that I create via code to filter the report.

But, from what your question is... You want to read the current filter as it appears on the form. Not sure... Perhaps there is a cmdsys. function or something... Steve Medvid
"IT Consultant & Web Master"
 
I was unable to get a report to 'use' the current Filter active on a form. I ended up creating a query within which I placed a parameter which the query prompts the user for each time it is run and basing the report on that query.

This still requires the user to enter the same data twice, once to filter the form and another time to print the report. I'd be grateful if somoeone knows a way to simply tell the report to 'act' only on the current record in the form (ie the one selected by the filter in this case - or I'm open to another way to do the same thing)

Thanks!
 
Your form knows what record ( key field) is currently selected, even on a continuous form. The form can contains the initial inputs from the user and many other fields associated with the record(s) being displayed. The report query criteria or report filter should be able to monitor or reference the fields (values) on the form and use this value(s) as its filter. Your question may be more complicated than I see; however, it's sound very straight forward.

For example: in the design mode of the query for the report,
1. put your cursor in the criteria of the feld you want to filter
2. select the wizard (wand icon)
3. on the left list in the dialog box select FORMS and drill down and select the form you are using
4. on the right list, select the field on the form you want to use as your filter for the report
5. do this for any otheradditional cirteria yo may need
6. save the query
Now the report will look to the open form to retrieve filter information.

There are several way to do most things in Access and this is one of the basic methods. Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top