查询中的 Concat 相关函数 [英] ConcatRelated function in a query

查看:32
本文介绍了查询中的 Concat 相关函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Access 2003 中创建一个报告,该报告在单个串联字符串中列出每个人的所有子项.Allen Browne 的 ConcatRelated() 看起来很有希望.

I'm trying to create a report in Access 2003 that lists all children for each individual in a single concatenated string. Allen Browne's ConcatRelated() looked promising.

所以我将代码复制到一个模块中,从调试菜单编译它(什么也没发生)并进行了查询:

So I copied the code into a module, compiled it from the debug menu (nothing happened) and made a query:

SELECT Moms.MomID, Moms.MomLast, ConcatRelated("KidFirst","Kids","MomID =" & Kids.MomID)
FROM Kids INNER JOIN Moms ON Kids.MomID = Moms.MomID;

我收到一个错误消息,显示表达式中未定义的函数‘Concatrelated’.

And I get an error that says "Undefined function 'Concatrelated' in expression.

出了什么问题?我唯一偏离方向的地方是在模块名称中键入ConcatRelated".

What has gone wrong? The only place I deviated from the directions was to type "ConcatRelated" in the module name.

推荐答案

不要把模块和函数一样调用,它有时会让 VBA 感到困惑.
例如,将模块重命名为DatabaseUtils".

Do not call the Module the same as the function, it can sometimes make things confusing for VBA.
Rename the module something like "DatabaseUtils" for instance.

确保函数确实定义为Public Function ConcatRelated(...,这里的Public很重要,否则函数在模块本身之外是不可见的.

Make sure the function is really defined as Public Function ConcatRelated(..., the Public here is important, otherwise the function will not be visible outside the module itself.

这篇关于查询中的 Concat 相关函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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