微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决使用 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 举报,一经查实,本站将立刻删除。