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

Report from Filter by Form

Status
Not open for further replies.

chappie2

Technical User
May 18, 2004
29
US
I am trying to preview a report based on a Filter by Form. The thread Thread703-796248 provided the coding below, which works great when the form is based on a single table.

If Me.FilterOn Then
DoCmd.OpenReport stDocName, acViewPreview, , Me.Filter
Else
DoCmd.OpenReport stDocName, acViewPreview
End If

However, I use a "generic" query to show fields from three different tables in the form. (There are no criteria specified in the query.) When I use the above coding, I get a message box about supplying a value, which does not affect the records generated for the report.

Can someone suggest language that will pass the records from a "filter by form" to a report when the form is based on a query of multiple tables?

Thanks,

Lloyd

 
I am sure that would work. But users can use filter by form to create the list of records they would like to report on. It would be slick if I could go from the list of records shown on a form to the same records in a report.

Lloyd
 
Try Creating a Button (Something Like "Go...") then in the onclick event proceedure:

If Me.filterOn Then
Docmd.openform "FormName",acViewPreview, , Me.Filter
else
Docmd.openform "FormName",acViewPreview
End If

Try This.

 
Thanks, that is exactly how I finally got it to work.

I have identified at least four different ways that a sort could be applied to a report:
1) from an originating query,
2) from the "Order By" property of an originating form,
3) settings in Sorting and Grouping of the report, and
4) in macros and code associated with opening the report.

Can someone explain which of these various options "rules" and/or interact? My sense is that settings in the Sorting and Grouping seem to control.

Thanks.

Lloyd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top