访问2003控制源使用来自外部查询的数据 [英] access 2003 control source use data from external query
问题描述
我在Access 2003中有一个复杂的报告。除了提供报告的查询外,我还设置了一些控制源来从其他查询中收集数据。
一个字段使用以下为控制源:
=格式(nz([qryBudgetFilteredByThisFiscalYear12.CNS / Amer12],0),货币)
这是有效的精细。但是,当我将其更改为:
=格式(nz([qryBudgetFilteredByThisFiscalYear12.CNS / Amer13],0),货币)
我得到错误说无效的名称包围。
查询qryBudgetFilteredByThisFiscalYear12是交叉表。其中一个列标题是CNS / Amer12,一个是CNS / Amer13。
我应该看看哪些想法?
< blockquote> Carlos,
我看的第一个地方是从查询字段名称中删除斜杠。因为斜杠也可以用于除法,所以将它包含在字段名称中是不明智的。这可能导致你上面的第二个例子试图划分两个值。
我无法解释为什么它适用于第一个,unles你对报告有控制权名字为qryBudgetFilteredByThisFiscalYear12.CNS / Amer12。
只是抛弃一些想法和额外的数据库最佳实践建议。
让我知道这是否有帮助。
感谢您的帮助。我看着斜线,认为它不应该在那里。不幸的是,我有这么多嵌套查询,我需要几个小时才能删除,所以我试图避免这种情况。
我确实试图创建一个新的空白报告与相关报告相同的记录来源。然后我添加了一个文本控件并使用我的问题中输入的两个表达式并得到了类似的结果:第一个工作,第二个产生相同的错误消息。
这是SQL从我试图用作控制源的查询:
展开 | 选择 | Wrap | 行号
I have a complex report in Access 2003. In addition to the query that feeds the report, I have some control sources set to gather data from other queries.
One field uses the following for the control source:
=Format(nz([qryBudgetFilteredByThisFiscalYear12.CNS/Amer12],0),"Currency")
This works fine. However when I change this to:
=Format(nz([qryBudgetFilteredByThisFiscalYear12.CNS/Amer13],0),"Currency")
I get an error saying "Invalid bracketing of name".
The query qryBudgetFilteredByThisFiscalYear12 is a crosstab. One of the column headings is CNS/Amer12 and one is CNS/Amer13.
Any ideas where I should look?解决方案Carlos,
The first place I would look is to remove the slash from the query field name. since the slash can also be used for division, it is never wise to include that in a field name. This may be causing your second example above to try to divide two values.
I can''t explain why it works for the first one, unles you have a control on the report that has the name "qryBudgetFilteredByThisFiscalYear12.CNS/Amer12".
Just throwing out some ideas and additional DB best practices advice.
let me know if this helps.
Thanks for the help. I was looking at the slash thinking it shouldn''t be there. Unfortunately, I have so many nested queries that it would take me a couple of hours to remove so I am trying to avoid this.
I did try to create a new blank report with the same record source as the report in question. I then added a text control and used both of the expressions entered in my question and received similar results: the first one work, the second one produced the same error message.
This is the SQL from the query I am trying to use as the control source:
Expand|Select|Wrap|Line Numbers
这篇关于访问2003控制源使用来自外部查询的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文