vba 访问:选择多条记录打印报表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6047168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 13:15:38  来源:igfitidea点击:

Access: Select multiple records to print report

ms-accessvba

提问by Rick

I am trying to design a form where I can select multiple records and on button click open the report with the selected records IDs.

我正在尝试设计一个表单,我可以在其中选择多个记录,然后单击按钮打开带有所选记录 ID 的报告。

I am thinking maybe make a continuous form with an added unbound check box control where the user selects the appropriate records they want to display in the report. I am unsure how to later read this into a do.cmd OpenReport criteria property. If there is an easier way to this please let me know.

我想也许可以使用添加的未绑定复选框控件制作一个连续表单,用户可以在其中选择他们想要在报告中显示的适当记录。我不确定稍后如何将其读入 do.cmd OpenReport 标准属性。如果有更简单的方法,请告诉我。

回答by TheOtherTimDuncan

Take a look at http://support.microsoft.com/kb/135546or http://allenbrowne.com/ser-50.html. Another approach you could take is create a temporary table that contains a single field for your record ID. Using the code from the links, fill the temporary table with the record IDs that have been selected. Then all you need to do is change the query that drives your report to do an inner join with the temporary table.

看看http://support.microsoft.com/kb/135546http://allenbrowne.com/ser-50.html。您可以采用的另一种方法是创建一个临时表,其中包含您的记录 ID 的单个字段。使用链接中的代码,用已选择的记录 ID 填充临时表。然后您需要做的就是更改驱动您的报表的查询,以与临时表进行内部联接。

回答by Beth

Can you add a column to your dataset where they can determine which rows to print? You could add a printMe Y/N column, for example, and then use that field value to limit the rows for the report.

您能否在数据集中添加一列,以便他们确定要打印哪些行?例如,您可以添加一个 printMe Y/N 列,然后使用该字段值来限制报告的行数。