Solved Calculated text field in query from different tables (1 Viewer)

Cris VS

Member
Local time
Today, 04:06
Joined
Sep 16, 2021
Messages
75
Hello, I was wondering if someone could give me a hint on this one. I have created a sample db to exemplify my doubt better.
So I have a table "Clothes" and a table "Materials" and a third table where it is specified what materials compose each garment. I wanted to know if there is a way to create a field "composition" for each row of clothes that is a calculated field of the corresponding materials, something like FieldComposition: do [FieldComposition] = [ FieldComposition] & [Material] while [clothname]. I don't need the field to be stored in the clothes table, it can be in a query as I need it for export features only. Thanks
 

Attachments

  • Database1.accdb
    632 KB · Views: 316

bob fitz

AWF VIP
Local time
Today, 03:06
Joined
May 23, 2011
Messages
4,719
I don't understand what you are looking for. Your query already lists the materials used in each garment.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:06
Joined
May 7, 2009
Messages
19,229
do you need to Concatenate (ConcatRelated() function?) all materials in a single string.
 

Cris VS

Member
Local time
Today, 04:06
Joined
Sep 16, 2021
Messages
75
do you need to Concatenate (ConcatRelated() function?) all materials in a single string.
Yes, I think that would be it. I have never used this function, how would be the syntax to join all the materials of a cloth?
Your query already lists the materials used in each garment.
I want to create a field (in the clothes' table or in a query) that lets me display in a single field/string the list of materials for each cloth
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:06
Joined
May 7, 2009
Messages
19,229
google Allen Browne's ConcatRelated() function, it has a sample usage.
only do it in a Query.
 

Cris VS

Member
Local time
Today, 04:06
Joined
Sep 16, 2021
Messages
75
This was very useful, thank you! However, I am not getting the third argument right, how should it be to serve my purpose here? I tried this in a query but it doesn't work:
Code:
FieldComposition: ConcatRelated("[Material]","[Materials]","[ClothName]=" & [ClothName],"",Chr(13) & Chr(10))
 

Users who are viewing this thread

Top Bottom