需要在报告中获取查询结果,Access 2016 [英] Need to get result of query onto a report, Access 2016

查看:71
本文介绍了需要在报告中获取查询结果,Access 2016的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道论坛是否涵盖了查询,或者只是vba,但是这里有。

我正在寻找一种方法将查询结果写入我的报告。该报告每月发送给客户,并基于名为tblAccount的表。我需要计算这个账户的每周费用,为此,我需要得到当前月份的星期四,4或5的值。该字段目前在表格中,称为Thurs1。 />
我已经进行了查询,其结果为我提供了相关的数字4或5,具体取决于当前月份。我需要将该值转换为报表的控件。此控件中的数字稍后将用于计算每周费用x数字(本月的周数,基于星期四)。

报告上还有许多其他计算和一些vba代码通过电子邮件发送这些帐户所有计算都基于子报告或表格中的字段,因此我可以在任何地方计算值,只要我可以将该值传递给报告上的文本框。

感谢你提出的任何建议。

I don''t know if the forum covers queries or just vba but here goes.
I''m looking for a way to get the result of a query onto my report. The report is sent to customers monthly and is based on a table called tblAccount. I need to calculate weekly charges on this account and to do that, I need to have the value of the number of Thursdays in the current month, 4 or 5. The field for this is currently in the table and is called Thurs1.
I have made a query, the result of which gives me the relevant number 4 or 5 depending obviously on the current month. I need to get that value into a control on the report. The number in this control will later be used to calculate weekly charges x the number (weeks in the month, based on the Thursdays).
There are lots of other calculations on the report and some vba code to send these accounts by email. All of the calculations are based on sub-reports, or on the fields in the table, so I could calculate the value anywhere, so long as I can pass that value to a textbox on the report.
Thank you for any suggestions that you may have.

推荐答案

你可以有一个未绑定的文本框,它使用DLookup作为它的记录源来获取该值,只要报告已打开。我不确切知道周四的数量是如何保存的,但它可以起作用。


希望hepps。
You could have an unbound text box that uses DLookup as it''s Record Source to get that value whenever the Report is opened. I don''t know exactly how that number of Thursdays is saved, but it could work.

Hope that hepps.


我想我建议这样一个解决方案Twinny会非常谨慎。


与报表或表单上的任何其他字段一样,它们最好由底层填充.RecordSource 。如果OP在查询中有这个,那么它应该只是绑定到一个Control(可能是 TextBox )。


数据不是'存储在表单或报表上。它们只是用于反映其他地方的数据 - 通常是通过链接到查询或直接连接到表。该值可以在函数中返回,但即使在填充基础查询时通常也会调用该值。


有时间和地点使用 DLookup( ),但它绝对不是一个常见的时间或地点。 IE浏览器。好的设计很少包含对 DLookup()的引用 - 尤其不在查询中。
I think I''d be very cautious of suggesting such a solution Twinny.

Like any other field on a Report or Form, they are best populated by the underlying .RecordSource. If the OP has that in their query then it should simply be bound to a Control (TextBox probably).

Data isn''t stored on Forms or Reports. They''re simply used to reflect data held elsewhere - usually by linking to a query or directly to a table even. The value could be returned in a Function, but even that would be generally called while populating the underlying query.

There is a time and place for using DLookup(), but it''s definitely not a common time or place. IE. It''s rare that a good design will include references to DLookup() - especially not within a query.


Sage建议,像往常一样,NeoPa!


因此,记住这一点,在这种情况下,只需将表格中的星期四数量添加到查询中?我不知道该表的结构,因此需要提供更多细节以提供具体细节。
Sage advice, as usual, NeoPa!

So, keeping this in mind, in this case, just add the table with the Number of Thursdays to the Query? I don''t know the structure of that table, so greater details would need to be provided to give specific details.


这篇关于需要在报告中获取查询结果,Access 2016的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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