使用表单中的过滤器生成报告 [英] Report generation with filter in form

查看:182
本文介绍了使用表单中的过滤器生成报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在将where子句SQL传递到报表中进行预览时遇到了问题。我创建的表单允许用户在生成报告之前进行3个选择步骤:日期范围,按选择的组和按字段分组的变量过滤器。到目前为止,我将日期范围选择放在一边,并尝试通过选择和变量过滤器使报告仅与组一起工作。下面是我到目前为止编写的代码。

Hi guys, I''m having problem with passing the where clause SQL into the report for preview. The form I created allows users to make 3 steps of selection before the report is generated: The date range, a group by selection, and the variable filter for the group by field. By now I put the date range selection aside and try to get the report working with just the group by selection and the variable filter. Below is the code I had written so far.

展开 | 选择 | Wrap | 行号

推荐答案

我已排序out部分宽度大于页面宽度来自Microsoft支持页面的问题,现在代码以我想要的方式运行。


我们通常需要做的是在下设置保证金页面布局缩小普通
I had sort out "the section width is greater than the page width" problem from the Microsoft support page and now the code runs with what I want.

Generally all we need to do is to set the Margin under Page Layout from Narrow to Normal.



原因:我重新编写了代码,因此它重新创建了作为报告记录源的查询
Reason: I had re-write the code so it re-create the query that is the record source of the report



作为一般规则,使用main时更好访问对象(报告和表单)以使记录源保持静态,并在运行时将过滤器应用于对象。这确实简化了事情,特别是对于编码。您可以计算代码中的过滤器字符串,然后在预览和打印时将相同的字符串应用于对象。这是否有意义。

As a general rule, it is better when working with main Access objects (reports & forms) to keep the recordsource static and apply a filter to the object at runtime. This really does simplify things, especially for coding. You work out what the filter string is in your code, then apply this same string to the object when you preview it as well as when you print it. Does this make sense.


@NeoPa


是的,我理解你的意思,我会尝试以更静态的方式重构代码因为我可以在这个方法中得到我想要的结果。
@NeoPa
Yes I understand your mean, I will try restructure the code in a more static way as I can get the my desired result in this method.


这篇关于使用表单中的过滤器生成报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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