Leban的PDF报告问题 [英] Leban's Report to PDF question

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

问题描述

大家好!我是新来的,对Leban的pdf工具报告有疑问。我正在使用一个数据库,我们使用这个代码将报告发送到pdf(duh)但是我需要做的事情有点复杂。


基本上db保持跟踪各个地方的库存。每个月,必须为76个地点运行一个报告并输入pdf,以便将报告放到sharepoint上。


我希望数据库循环遍历各种AreaID代码和使用AreaName作为报告名称为每个区域创建pdf报告。从列表框中选择报告,当我们单击创建pdf按钮时,正在创建pdf,但是将其命名为报告名称而不是区域名称。 (我还没有循环它,因为我想确保在我做76之前可以正确保存一个报告!)


代码的部分引用了什么名称pdf是这样的:

Me.lstRptName.Value& .pdf


我的问题(现在)是如何从列表框中显示的报告中访问AreaName并使用它来命名pdf?


谢谢!


Jessica

Hi everyone! I''m new here and have a question regarding Leban''s report to pdf tool. I am working on a database where we are using this code to send a report out to pdf(duh) BUT what I need to do is a bit more complicated.

Basically the db keeps track of stock in various locations. Each month, a report must be run for the 76 locations and put into pdf so the reports can be put onto sharepoint .

I would like the database to loop through the various AreaID codes and create a pdf report for each area using the AreaName as the report name. The report is being selected from a list box and when we click on the create pdf button, the pdf is being created, but is being named the report name rather than the area name. (I dont have it looping yet as I would like to be sure I can get one report saved correctly before I do 76!)

The part of the code that refers to what to name the pdf is this:
Me.lstRptName.Value & ".pdf"

my question (for now) is how to access the AreaName from the report shown in the list box and use that to name the pdf?

Thanks!

Jessica

推荐答案

嗨Jessica,欢迎来到Bytes!

如果你目前在列表框中没有theaname,最简单的方法是将它作为pdf文件的名称传递(实际上它不可能从报告中获取它)本身,在那个阶段没有打开)是将它包含在作为列表框源的查询中,然后将该列的列宽设置为0,这样它就不会显示给用户。


您可以使用列表框的Column属性来引用与默认列不同的列。在组合或列表框中,列的编号从0开始,列(0)是默认(第一列),列(1)是第二列,依此类推。


你不喜欢t说明你的isaname所在的列(如果它确实已经在列表框中)。如果我认为它是第二列,您将从报告名单列表框中获取以下名称:


Me.lstRptName.Column(1)& < .pdf"


如果实际上isaname在其他列中,只需用正确的列号代替所示的1,记住编号从0开始。 br />


-Stewart
Hi Jessica, and Welcome to Bytes!

If you don''t have the areaname in the listbox at present the simplest way to get it passed as the name of the pdf file (it really it is not possible to get it from the report itself, which is not open at that stage) is to include it in the query which is the source for the listbox, then set the column width for that column to 0 so it is not shown to the user.

You can use the Column property of the listbox to refer to a different column than the default. In a combo or listbox the columns are numbered from 0, with Column (0) the default (first) column, column (1) the second and so on.

You don''t say which column your areaname is in (if indeed it is already in the listbox). If I assume it is the second column, you would obtain the areaname from your reportname listbox as follows:

Me.lstRptName.Column(1) & ".pdf"

If in fact the areaname is in some other column, just substitute the correct column number in place of the 1 shown, remembering that the numbering starts at 0.


-Stewart



您好Jessica,欢迎来到Bytes!


如果你目前在列表框中没有theaname,最简单的方法是将它作为pdf文件的名称传递(实际上它不可能从报告本身(在该阶段未打开)是将其包含在作为列表框源的查询中,然后将该列的列宽设置为0,以便不向用户显示。

-Stewart
Hi Jessica, and Welcome to Bytes!

If you don''t have the areaname in the listbox at present the simplest way to get it passed as the name of the pdf file (it really it is not possible to get it from the report itself, which is not open at that stage) is to include it in the query which is the source for the listbox, then set the column width for that column to 0 so it is not shown to the user.
-Stewart



谢谢Stewart

我不确定这会有效,因为我打算运行76 pdf'离开这一份报告。这就是我的想法:


打开一个记录集,其中包含所有AreaID的列表

遍历每个区域ID,使用该区域作为参数/报告的过滤器

每个报告都要通过Leban的pdf代码并将其转换为带有AreaName作为文件名的pdf。


是有一个更简单的方法来做到这一点?


我还应该提一下,报告还有ReportDate的参数(月和年),所以现在,我点击按钮,报​​告要求我输入ReportDate然后,AreaID将报告输出为pdf(当前报告名称为文件名,因此所有报告都命名为OpCoReport.pdf,我运行的下一个报告将覆盖它)。因为有76个区域,我必须手动重复76次(并在我执行下一个之前重命名每个pdf)或取出areaID参数并运行一个大的报告,这也不起作用,因为我仍然需要拆分它分为76个人。


感谢您的帮助!

Jessica


Thanks Stewart
I''m not sure this will work as it is my intent to run 76 pdf''s off of this one report. This is what I am thinking:

open a recordset with a list of all the AreaIDs
loop through each area ID, using that area as the parameter/filter for the report
have each report go through Leban''s pdf code and turn it into a pdf with the AreaName as the file name.

Is there an easier way to do this?

I should also mention that the report also has a parameter for the ReportDate (month and year) so as it stands now, I click the button and the report asks me to input the ReportDate and AreaID then outputs the report as a pdf (which currently comes up with the reportname as the file name, so all reports are just named OpCoReport.pdf and the next one I run would overwrite it). Because there are 76 areas I have to either repeat this manually 76 times (and rename each pdf before I do the next) or take out the areaID parameter and run one large report which also doesnt work because the I would still have to split it up into 76 individual ones.

Thanks for your help!
Jessica


您好Jessica。你建议的方法对我来说似乎很好。根据您的报告的数据源查询创建一个新查询,该查询被分组以列出唯一的区域名称,然后将该查询作为代码中的记录集打开,并按照您的建议循环遍历所有区域名称,使用这些(以及任何日期)等)来过滤你的报告。您应该从报告的基础源查询中删除AreaID并报告日期参数提示 - 以阻止每次传递时提示这些提示。如果您运行的每个报告的这些值必须不同,您需要考虑将相关值传递给76个报告实例的某种方式,但如果每次将未绑定的控件放在您的表单上,则它是相同的值将在过滤报告时运行报告并在您的代码中引用这些报告。


我还会更改Lebans代码以将报告的名称作为可选参数传递 - 是可选的,当未提供参数时,Lebans代码可以像现在一样运行,仅当参数具有指定值时才替换给定的报告名称。


我没有Lebans代码在我面前指导你放置参数的位置并插入一个IF来检查它的值 - 你需要自己做。


可选参数在VBA例程的参数列表中排在最后:

Hi Jessica. The approach you are suggesting seems fine to me. Create a new query based upon your report''s data source query that is grouped to list the unique area names, then open that query as a recordset in code and loop through all area names just as you suggest, using these (and any dates etc) to filter your reports. You should remove the AreaID and report date parameter prompts from the report''s underlying source query - to stop these being prompted for on every pass. If these values must be different for every report you run you will need to think of some way to pass the relevant value to the 76 report instances, but if it is the same value every time you should place unbound controls on the form from which you will run the reports and refer to these in your code when filtering the reports.

I would also alter the Lebans code to pass the name of the report as an optional parameter - being optional, the Lebans code could function as now when the parameter is not supplied, substituting the given report name only when the parameter has a specified value.

I do not have the Lebans code in front of me to guide you where to place the parameter and insert an IF to check its value - you will need to do that yourself.

Optional parameters come last in the argument list of VBA routines:

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


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

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