3

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;

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

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

1 Answer 1

4

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.

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.

1
  • I figured it out quite late last night and it's working now. I'd never created/named a module before. The rest of the function is exactly as written by Allen Browne, so it is Public Function...
    – QtheNovice
    Sep 23, 2013 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.