如何打开带有记录源数据子集的MS-Access报告? [英] How do I open an MS-Access report with a subset of the recordsource data?

查看:82
本文介绍了如何打开带有记录源数据子集的MS-Access报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询,该查询生成一个记录集,该记录集用于我用MS Access报告创建的计算机生成的发票.记录集看起来像这样(但有数百张发票):

I have a query that produces a recordset that I use for a computer generated invoice that I have created with an MS Access report. The recordset looks something like this (but with hundreds of invoices):

ControlNumber|ShippingAddress|InventoryDescription|...
17-001        123 Fake St     Description A
17-002        145 No addr     Description B
17-003        23456 new st    Description C

我已经设置了报告,因此它将为系统中的每个发票在不同的页面上生成单独的完全填写的发票.不过,我不想搜寻数百个来找到我要打印的特定纸张.

I have the report set up so it will generate me separate completely filled out invoices on a different page for every invoice in the system. I don't want to have to hunt through hundreds of them to find the specific one I want to print, though.

我还有另一个MS Access表格,操作员可使用该表格通过下拉组合框和一个按钮选择要打印的这些发票中的哪一个.在使用下拉菜单选择要打印的那张(例如17-003)之后,我要点击按钮,并仅用一张发票将报告弹出.我如何告诉报告仅向我显示该记录集的子集?

I have another MS Access form that the operator uses to select which of these invoices to print with a drop down combo box, and a button. After I use the dropdown to choose which one I want to print (say 17-003), I want to hit the button and have the report pop up with only that one single invoice. How do I tell the report to only show me a subset of that recordset?

我可以使用现有的Access函数,也可以在必要时编写VBA代码,但如果可能的话,我不希望默认不使用VBA.

I am fine with using existing Access functions or with writing VBA code if necessary, but I would prefer to not default to VBA if possible.

推荐答案

报表数据集的动态过滤选项:

Options for dynamic filtering of report dataset:

  1. 动态参数化查询作为报告RecordSource,可以是弹出式输入或对窗体上的控件的引用-我从不使用动态参数化查询

  1. dynamic parameterized query as the report RecordSource, this can be a popup input or reference to a control on form - I never use dynamic parameterized queries

在设计视图中手动打开报告并设置过滤器"属性,然后将报告切换为打印预览然后打印

manually open report in design view and set the Filter property then switch report to print preview then print

代码(宏或VBA)在报表打开时通过引用窗体上的控件来应用过滤器,例如VBA:DoCmd.OpenReport "report name", , , "ControlNumber='" & Me.cbxCN & "'"

code (macro or VBA) applies filter when report opens by referencing control on form, example VBA: DoCmd.OpenReport "report name", , , "ControlNumber='" & Me.cbxCN & "'"

这篇关于如何打开带有记录源数据子集的MS-Access报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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