Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Concat field related records
Andres Joubert 

2 years ago
I have three tables that I am working with. I have a source table that stores media sources information (i.e. NYTimes, NBC news, etc.). I have a format table that stores the various media formats sources may use to deliver their media (i.e. video, text, audio, etc.). I also have a junction table since these have a many-to-many relation.

I have a subform that pops up on from a "Add/Edit Sources" form. This subform allows the user to associate format types to the selected source in view, but when the window is closed, the main form does not show the selected options.

I would like to show on the main Add/Edit Sources form all the format types for the selected source in a comma-separated format without having to open the subform of format types. There will be many fields like this in the view so I cannot embed the subform as that would clog up the space. How can I display the various selected formats in a text field in a comma-separated format?
Adam Schwanz  @Reply  
           
2 years ago
If I understood the question correctly... I would do something like this (this is probably not the easiest way, I just gravitate to recordsets for things like this. I also don't know your layouts, but I'm assuming this is a single record, Media Source on the page that needs a list of the formats, if this is a subform with multiple Media Sources, this would need to be more advanced.)

I'd just put this in the on current event of the main form

Dim db as database
Dim rs as recordset

Set db = currentdb
set rs = db.openrecordset("Select * From JunctionTable Where MediaSourceID=" & MediaSourceID)

Dim X
X=""
While not rs.eof
If X = "" Then
X= rs!MediaFormat
Else
X=X & ", " & rs!MediaFormat
End If
rs.movenext
wend

TextboxOnMainForm = X

rs.close
db.close
set rs = nothing
set db = nothing

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/16/2026 7:33:37 PM. PLT: 0s