使用 VBA 在 Access 2013 中跨多列连接行

问题描述

我有一个 Access 数据库,它在任务分配给个人的多个阶段中跟踪每个行项目。每个阶段都有一个 Comments 字段,并记录在一个表中,如下所示:

Line Item     Stage    Title             Comments
    1           1      Introduction      Trial comment
    1           1      Introduction      Another one
    1           2      Abstract          Following one
    1           2      Abstract          Andi nexto
    1           3      Thesis            Nexto
    2           1      Introduction      Comment for next item
    2           1      Introduction      Andi another one
...

我希望能够将每个阶段和每个行项目的这些评论连接为:

Line Item     Stage    Title           Comments
    1           1      Introduction    Trial comment,Another one
    1           2      Abstract        Nexto one,Andi next
    1           3      Thesis          Nexto
    2           1      Introduction    Comment for nexto item,Andi another one

我尝试将 Allen brown 的 ConcatRelated() 函数与多个 WHERE 条件结合使用:

ConcatRelated("[Comments]","[CommentsT]","[LineItemNo]=" & "[txtLineItemNo] AND "[StageNo]=" & [txtStageNo])

但没有运气。在不考虑 StageNo 和 Title 的情况下,使用单个 WHERE 子句确实连接了必填字段中的所有注释。

请就我实现这一目标的最佳方式提出建议。

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)