根据客户 ID 将多页 MS Access 报告拆分为单独的 pdf 文件? [英] Splitting a Multi-Page MS Access report into individual pdf files based on a Customer ID?

查看:29
本文介绍了根据客户 ID 将多页 MS Access 报告拆分为单独的 pdf 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望根据客户 ID 将多页访问报告拆分为单独的 pdf 文件,然后根据客户名称(或 ID)保存这些 pdf 文件.

I'm looking to split a multi-page access report up into individual pdf files based on a Customer ID and then saving those pdf files based on the Customer Name (or ID).

我研究过将报告打印"/转换"成一个庞大的 pdf 文件并在那里拆分,但有些客户发票跨越两页以上,因此逐页拆分该 pdf 文件不起作用.

I've looked into 'printing'/'converting' the report into one massive pdf file and splitting it there, but some customer invoices span two+ pages, therefore splitting that one pdf file page-by-page doesn't work.

任何帮助将不胜感激;如果有人需要更多说明,请随时告诉我.

Any help would be greatly appreciated; if anyone needs more clarification on anything, don't hesitate to let me know.

推荐答案

这可以通过 Access 2007(请参阅下面的注释)或更高版本轻松实现.

This can be easy with Access 2007 (see note below) or later.

使用 WhereCondition 参数打开您的报告以将记录源限制为特定客户.

Open your report using the WhereCondition parameter to limit the record source to a specific customer.

DoCmd.OpenReport "rptFoo", acViewPreview, , "Customer_ID = 1"

然后使用 OutputTo 以您提供的文件名将其保存为 PDF.

Then use OutputTo to save it as PDF with a file name you supply.

DoCmd.OutputTo acOutputReport, "", acFormatPDF, "Spacely_Sprockets.pdf"

之后关闭报告.

DoCmd.Close acReport, "rptFoo"

您可以创建一个过程,为 Customer_IDCustomer_Name 数据打开一个记录集,然后使用这 3 个命令和每行的值.

You could create a procedure which opens a recordset for Customer_ID and Customer_Name data, then use those 3 commands with values from each row.

如果您的 Access 版本早于 2007,您必须告诉我们您用于创建 PDF 文件的方法.

If your Access version is older than 2007, you'll have to tell us about the method you're using to create PDF files.

注意:对于 Access 2007,Office Service Pack 2 提供内置的另存为 PDF/XPS 支持.

Note: For Access 2007, Office Service Pack 2 provides Built-in Save As PDF/XPS support.

这篇关于根据客户 ID 将多页 MS Access 报告拆分为单独的 pdf 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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