Combining multiple columns into one row in one field

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

I have a link table, tblManufacturingInstructionsLink with 2 fields,
ProductCode & InstructionID. One ProductCode can have many
InstructionIDs, (I know that this is not ideal but this is how I have
inherited it). I also have tblinstructions (fields instructionID &
instruction). What I want to do is create a table with the
fields ProductCode and Instruction - a combination of all instructions from
the
instruction IDs in tblManufacturingInstructionsLink. E.g. ProductCode 1234
currently has 3
fields in tblManufacuturingInstructionsLink; instructionIDs 28, 43 & 76.
The new table
I want to create will have one row (instead of 3) with the instructions of
Ids 28,43 & 76
in one field, separated by commas. Can anyone help?

thanks in advance
 
This is exactly what I was looking for - many thanks

One problem I am having is that I can only seem to concatenate values when I
put in a varIDvalue (The value on which to return concatenated Instruction).
I have tried leaving this as "" but then it shows no instructions. Is it
possible to concatenate all product codes or do I have to one at a time?

Many thanks
 
You would need to modify that code so that the WHERE clause is omitted if
the varIDvalue is a Null or zero-length string.
 
Back
Top