子表单中的多个子报表和字段引用 [英] Multiple Subreports and field references in Subforms

查看:56
本文介绍了子表单中的多个子报表和字段引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


这只是我发现的问题的一小部分。我发现的解决方案:


我有一个运行查询的报告(query1)。在报告中还有2个子报告,这些子报告还有2个查询。这两个查询都与query1相关,query1使用对条件字段中的子表单控件的引用。所以从本质上讲,要在报告中获得任何结果,子窗体中控件的值是最重要的,并且必须在任何计算开始之前可用。


我发现的问题是此情况并非如此。查询的计算将在从控件检索值之前开始,然后查询将询问参数输入,并且主报表上的计算控件也没有显示结果但是名称?。代替。虽然,直接引用query1中的字段的控件工作得很好,所以我知道查询能够从子窗体控件中获取值 - 它看起来不够快。


尝试和使用参考语法的苦难,我决定在主窗体上创建一个隐藏文本框,引用子窗体上的控件。然后我使用query1引用此文本框以获取值,现在整个报告按原样运行。


我希望这个提示可以帮助某人,我希望进一步讨论为什么这一步是必须使它工作。


问候,

肯。

Hi everyone,

This is just a little rundown of a problem I discovered & the solution I found:

I have a report which runs off a query (query1). Within the report there are also 2 subreports which run off a further 2 queries. These 2 queries are both related to query1, and query1 uses a reference to a subform control in a criteria field. So in essence, to get any results in the report the value of the control in the subform is paramount and must be available before any of the calculations begin.

The problem I found is that this was not the case. The calculations of the queries would start before the value was retrieved from the control and the queries would then ask for parameter input, and also calculated controls on the main report didn''t show a result but "Name?" instead. Although, the controls that directly referenced fields in query1 worked perfectly, so I knew the query was able to get the value from the subform control - it just seemed not quickly enough.

After much trial and tribulation with the syntax of the reference, I decided to make a hidden textbox on the main form that referenced the control on the subform. I then made query1 reference this textbox to get the value and now the whole report runs as it should.

I hope this tip can help someone and I invite further discussion on why this step was necessary to make it work.

Regards,
Ken.

推荐答案

它''发布这个ken是一个不错的主意,但我不确定我们是否有足够的细节来确定这样做的原因。
我不会期望一个子窗体控件(正确访问)到在您的方案中,与主窗体上的控件的行为有所不同。也许这是你引用那个错误的项目。如果没有访问所有细节,很难确定。
It''s a nice idea to post this ken, but I''m not sure we have enough detail to determine why this is behaving this way.
I wouldn''t anticipate a subform control (correctly accessed) to behave any differently in your scenario from a control on the main form. Maybe it''s your referencing the item that''s wrong. It''s hard to know for sure without access to all the details.


嗨NeoPa,


在提出这个解决方案之前,我尝试了所有从外部模块引用的变体,正如您在这篇文章中所描述的那样文章,顺便说一句。具体来说:
Hi NeoPa,

Before coming up with this solution, I tried all the variants of referencing from an external module as you describe in this article (an excellent article, btw). Specifically:
  1. Forms![FormName]![SubFormName] .Form![ControlName]
  2. Forms(" FormName")![[ SubFormName] .Form![ControlName]
  3. Form_FormName![SubFormName] .Form![ControlName]

之前我没有提到的一件事是我能够得到这些最初工作,但当我保存并重新加载数据库时,它会显示我在上一篇文章中描述的行为。

所以我不认为引用语法是问题所在。除此之外,虽然不具体,但我相信我提供了相当详细的信息。我应该提供哪些额外信息?

无论如何,我很高兴我找到了一个有效的解决方案,无论它有多么优雅。


问候,

Ken。

One thing I didn''t mention before is that I was able to get these to work initially, but when i saved and reloaded the database, it would display the behaviour I described in my previous post.
So I don''t think the referencing syntax that was the problem. Other than this, while not specific I believe I supplied fairly detailed information. What extra information should I provide?
At any rate, I am pleased that I have found a solution that works, however inelegant it may be.

Regards,
Ken.



...

(一篇优秀的文章, btw)

...
...
(an excellent article, btw)
...



谢谢:)

Thanks :)


.. 。

所以我不认为引用语法是问题所在。除此之外,虽然不具体,但我相信我提供了相当详细的信息。我应该提供哪些额外信息?
...
So I don''t think the referencing syntax that was the problem. Other than this, while not specific I believe I supplied fairly detailed information. What extra information should I provide?



你做到了。我理解你所描述的情况。我根本没有足够详细的信息来建立一个错误的想法。远程诊断实际上严重依赖于详细信息(大多数时候 - 一些问题很明显)。在你的情况下,当然不明显出了什么问题。你似乎对问题有了合理的理解,那么我该怎么解释它不起作用呢?细节是我唯一的选择。

#Name?错误通常意味着您尝试引用的内容未正确完成。我不知道这可能是一个时间问题。为了推进我的理论,我特别需要SQL的细节和参考。基本上我需要检查一切,以确定你发生了什么。

You did. I understood the situation you were describing. I simply didn''t have enough detailed information upon which to build an idea of what was wrong. Remote diagnosis is actually heavily dependant on detailed information (most of the time - some questions are obvious). In your situation it was certainly not obvious what was wrong. You seemed to have a reasonable understanding of the issues, so what do I look for to explain it not working? The details is my only option.
The "#Name?" error generally means that something that you''re trying to reference is not correctly done. I''m not aware this can be a timing issue. To progress my theory I''d need the details of the SQL and the reference in particular. Basically everything I need to check to try to determine what''s going on for you.


无论如何,我很高兴我找到了一个有效的解决方案但无论多么优雅。
At any rate, I am pleased that I have found a solution that works, however inelegant it may be.



我也是。我不是在批评你的解决方案。

And so am I. I wasn''t trying to criticise your solution.


这篇关于子表单中的多个子报表和字段引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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