Avatar of SteveL13
SteveL13
Flag for United States of America asked on

How populate a field with records from a query separated by commas

I have a form that has a sub-form.  The sub-forms record source is a query and is displayed as a datasheet.  But what I'm trying to do is populate a field on the main form with data from the query in the subform.  But I need to populate the information as, for example, "Steve, Bill, David".  In other words, the results of the query separated with a comma and a space.

So if the query looks like this:

Names Example
Populate the field on the main form with "Steve, Bill, David"
Microsoft Access

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
Scott McDaniel (EE MVE )

You'd have to concatenate those values together if you want them to appear as a comma separated value in your main form.


What's the reason for populating data in the record's header, using data in the record detail section? Sounds like your data is properly stored, and you're trying to "flatten" it.

SteveL13

ASKER
I’m not trying to populate the header. just populate a field in the detail section of the form.
Scott McDaniel (EE MVE )

You wrote:


But what I'm trying to do is populate a field on the main form with data from the query in the subform.


That seems to indicate that you are taking data from the subform (your "detail" records) and using that data to populate something in the "main" form (your "header" record). 


If that's not correct, please provide examples of what you have not (i.e. the data structures, or pics of the form(s)), and what you want to do (again - pics or an excel example).



All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
SteveL13

ASKER
Actually forget the sub form. I only have it on the main form temporarily to show what should concatenate in the field on the main form.
SteveL13

ASKER
I just want to concatenate the results of a query and display the concatenation in the field.
SteveL13

ASKER
as demonstrated in the picture I posted.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
aikimark

ASKER CERTIFIED SOLUTION
Gustav Brock

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question