ConcatRelated returns duplicate records (1 Viewer)

cdwooff

New member
Local time
Today, 05:47
Joined
Dec 20, 2014
Messages
4
Hi I am new to this forum and am a novice with macros. I have been struggling with ConcatRelated If I create the basic orders table show in the example:

orders
Company OrderDate
Acme Corporation 1/1/2007
Acme Corporation 3/1/2007
Acme Corporation 7/1/2000
Acme Corporation 1/1/2008
Wright Time Pty Ltd 4/4/2007
Wright Time Pty Ltd 9/9/2007
Zoological Parasites


and then run this query:
ConcatRelated("OrderDate","Orders","[Company] = """ & [Company] & """")

Then I don't get the results given on the web page but instead get one output record per record in the table, viz:

Company Expr1
Acme Corporation 1/1/2007, 3/1/2007, 7/1/2000, 1/1/2008
Acme Corporation 1/1/2007, 3/1/2007, 7/1/2000, 1/1/2008
Acme Corporation 1/1/2007, 3/1/2007, 7/1/2000, 1/1/2008
Acme Corporation 1/1/2007, 3/1/2007, 7/1/2000, 1/1/2008
Wright Time Pty Ltd 4/4/2007, 9/9/2007
Wright Time Pty Ltd 4/4/2007, 9/9/2007
Zoological Parasites


I have seen one suggestion to change "SELECT" in the macro to "SELECT DISTINCT" but that made no difference.

Any help would be much appreciated.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 05:47
Joined
Feb 19, 2013
Messages
16,603
The distinct needs to be in your main query e.g.

SELECT DISTINCT Company, ConcatRelated(.....) AS OrderDates FROM ORDERS
 

cdwooff

New member
Local time
Today, 05:47
Joined
Dec 20, 2014
Messages
4
Many thanks CJ_London that did the trick.
 

Users who are viewing this thread

Top Bottom