根据表格排序顺序打印报告 [英] Print Report based on Form Sort Order

查看:83
本文介绍了根据表格排序顺序打印报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于查询的表单,用户可以在表单的任何字段中进行筛选和排序。我可以在用户过滤报告后打印预览报告,但如果用户对报告进行排序,则不会对报告进行排序。

我的表单上有一个按钮,其中包含以下代码打开报告的打印按钮:

I have a form based on a query where the user can filter and sort in any of the fields of the form. I am able to print preview a report once the user filters the report but if the user sorts the report it does not sort on the report.
I have a button on my form with the following code on a print button which opens the report:

展开 | 选择 | Wrap | 行号

推荐答案

特定字段排序表格不是表格过滤器的一部分,因此,在报告开启时不会反映在报告中。如果您知道可以对哪些字段进行排序,则可以在设计/隐藏中打开报表,然后修改RecordSource属性以反映表单的过滤器以及任何排序,如:
The specific Field Sort on the Form is not part of the Form''s Filter, and as such, will not reflect on the Report when it Opens. If you know what Fields may be Sorted you can Open the Report in Design/Hidden, then modify the RecordSource Property to reflect the Form''s Filter as well as any Sorting, as in:
展开 | 选择 | Wrap | 行号


如果您的用户表单可以告诉您要对哪个字段进行排序,则有一种方法可以比您构建新的SQL语句更容易应用记录源方法虽然不够灵活。它使用报告的OrderBy属性,如下所示:

If your user form can tell you which field you want to sort on there is a way to do so you may find easier to apply than building a new SQL statement recordsource method, although it is not as flexible. It uses the OrderBy property of the report, like this:

展开 | 选择 | Wrap | 行号


感谢斯图尔特的回复。考虑到字段是手动排序的,并且报告中的字段相同,您的第二个解决方案似乎可能对我有用。我应该把你列出的代码放在哪里?在打印命令按钮上或打开按钮上报告的事件?
Thank you Stewart for your response. Your second solution seems to be the one that may work for me considering the fields are manually sorted and the same on the report. Where should I put the code you listed? On the print command button or on the "on open" event of the report?


这篇关于根据表格排序顺序打印报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆