using filter when printing

  • Thread starter Thread starter Pierre
  • Start date Start date
P

Pierre

Hi all,

I have a print menu to choose between
numerical (based on the field dept) and alphabetical order (based on field
desc) of a simple report.

The report is based on a query with no order at all.

I have only one report, (i dont want to make 2 reports)

I use docmd.openreport "rptName", intView, strFilterName

where strFilterName is the name of a query and i have 2 different queries
one for alpha and one for num

It is not working.

What is the simplest way to print the 2 different reports without
multiplying reports and query.

Regards,
Pierre
 
The FilterName argument for OpenReport is useless for filtering or sorting.

The sort order of records in a report relies on the entry in its Sorting and
Grouping dialog. You can programmatically switch fields there, as described
in this article:
Sorting Records in a Report at run-time
at:
http://allenbrowne.com/ser-33.html

If you have nothing in the report's Sorting'n'Grouping dialog, you can
programmatically set its OrderBy property in the Open event of the report,
remembering to set OrderByOn as well.
 
Back
Top