连接值并按sectionID分组 [英] Concatenate values and group by sectionID

查看:82
本文介绍了连接值并按sectionID分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Access的新手,所以我希望你能帮助我指出正确的方向。试着理解这个。


我有这样的数据:


问题等级1 |问题2] SectionID |问题文本|回复

1 | a | 1 |天空是什么颜色? |蓝色

1 | b | 1 |你喜欢学校的什么? |午餐

2 | 1 |你最喜欢的情景喜剧是什么? | Seinfeld

4 | 2 |谁是最好的汉堡包? |麦当劳

5 | 2 |你最喜欢的汽车是什么类型的? |雪佛兰


该报告的Recordsource是一个交叉表查询。报告按SectionID分组,我有一个未绑定的文本框txtResponseAggregate在SectionID页脚。我想在txtResponseAggregate中显示:

在第1节中:

1a)蓝色; 1b)午餐; 2 Seinfeld

在第2节中:

4麦当劳; 5雪佛兰


注意:有时SectionID'不是连续的(取决于数据),即可能有1,2,3,5,10等部分。


我发现这个http://allenbrowne.com/func-concat.html但我不知道如何将SectionID作为过滤器传递。我是否使用子报告?


提前谢谢。

New to Access so I hope you can help point me in the right direction. Trying to get my head around this.

I have data like so:

Question level1 | Question level2 | SectionID | Question text | Response
1 |a | 1 | what color is the sky? | Blue
1 |b | 1 | what do you like about school? | Lunch
2 | 1 | what is your favorite sitcom? | Seinfeld
4 | 2 | Who makes the best hamburgers? | McDonalds
5 | 2 | What is your favorite type of car? | Chevrolet

Recordsource for the report is a crosstab query. Report is grouped on SectionID and I have an unbound textbox "txtResponseAggregate" at the SectionID footer. I would like to show this in txtResponseAggregate:

In the section 1 footer:
1a) Blue; 1b) Lunch; 2 Seinfeld

In the Section 2 footer:
4 McDonalds; 5 Chevrolet

Note: sometimes the SectionID''s are not contiguous (depends on data) i.e. might have section 1,2,3,5,10, etc.

I found this http://allenbrowne.com/func-concat.html but I do not see how I can pass the SectionID as a filter. Do I use a sub-report?

Thanks in advance.

推荐答案

你可能会发现在GROUP BY集中列出项目很有帮助。这不是我一般会推荐的方法(如链接线程中所解释的那样),但如果你必须这样做,那么他们会解释如何。
You may find Listing Items Within GROUP BY Set helpful. It''s not an approach I''d generally recommend (as explained within the linked threads) but if you must do it then they explain how.


感谢NeoPa。我会研究这些解决方案,如果(当)我被卡住的话会回复。


干杯。
Thanks NeoPa. I will study those solutions and post back if(when) I get stuck.

Cheers.


NeoPa - 感谢您指点我的代码引用。它工作正常,但是如果响应,它会在标准表达式中生成数据类型不匹配。如果留空(有时会是这样)。对此有何解决方案?
NeoPa - thanks for pointing me to the code referenced. It works fine however it generates a data type mismatch in criteria expression if "Response" if left blank (which sometimes it will be). Any solutions for this?


这篇关于连接值并按sectionID分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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