拆分报告 [英] Splitting a Report

查看:72
本文介绍了拆分报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一份访问报告,可以查看特定高中的学生并提供他们的日程安排。目前这是一份150页的报告,约有100所独立的高中。我现在已将其设置为以PDF格式输出报告。 (由于学生人数较多,一些高中会占用几页报告。)

我想要做的是,使用VBA,我想将报告拆分为中学。每个学校一个pdf。以下是我目前正在使用的代码。

<跨度类= codeLink 的onclick =模糊(此,this.parentNode.parentNode,的getChildren (this),true);>展开 | 选择 < span class =codeDivider> | Wrap | 行号

解决方案
的的OpenReport滤波器是不会适用于OutputTo命令。相反,修改报表在OutputTo命令之前使用的查询def。


我认为问题是导出导出的是保存的报表(没有条件)而不是报表按标准打开。我确信有一个更简单的解决方案,但我看到的解决此问题的一种方法是将报告基于临时表并使用您的循环删除以前的记录,然后输入过滤后的数据。通常这将使用查询的WHERE子句来完成,但我不知道如何使用DoCmd.OutputTo命令将参数传递给查询。


编辑:关注兔子的想法:)


你是否介意通过修改查询def澄清你的意思?

我还有另外一点......当我逐行遍历代码时,当我执行openreport方法时,报告显示访问时没有应用过滤器。我觉得这是错的。

再次感谢您的快速回复。


I have an Access report that looks at students in specific high schools and gives their schedule. At the moment it is a 150 page report, for about 100 unique high schools. I have it set up at the moment to output the report as a PDF. (Some high schools take up several pages of the report due to more students.)

What I want to do is, using VBA, I''d like to split the report up by high school. One pdf for each school. The following is the code I''m currently using.

Expand|Select|Wrap|Line Numbers

解决方案

The OpenReport filter is not going to apply to the OutputTo command. Instead, modify the query def that the report uses before the OutputTo command.


I believe that the problem is that your export is exporting the report that is saved (no criteria) not the report that was opened with a criteria. I''m sure that there is an easier solution, but one way to get around this that I see is to base the report on a temp table and use your loop to delete previous records and then input the filtered data. Normally this would be done using a query''s WHERE clause, but I''m not sure how to pass a parameter to the query using the DoCmd.OutputTo command.

EDIT: Follow Rabbits idea :)


Would you mind clarifying what you mean by modifying the query def?
And another point I have...When i step through the code line by line, when I execute the openreport method, the report shows in access with no filter applied. I feel like this is wrong.
Thanks again for the quick replies.


这篇关于拆分报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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