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 
Query Concantenated Field
Scott Crippen 
   
4 years ago
I am working on a music database.Within my form, I am using a listbox with multiselect enabled.When saved, all the selected genres for the song are entered into one field for the form.If there are multiple selections made, in the form, they are concatenated and everything looks great in the one control source (genre) field on the form and in the table.What I am struggling with is later.

Essentially, I need to save the selected items individually within the same table.  How do I get the selected items from the field (or from the listbox) to a Yes/no field in the same table?

On another form, I want to search all songs for a specific genre, I need to query from within the saved concatenated results and somehow parse out each different selection first. The only alternative I can see is to add each of 20+ genre types (pop, rock, disco...) into the table and maybe somehow force the selected items to do a yes/no or true/false but that also complicates a search query.

I really don't want to make a checkbox to save each genre into the field and then yes/no for each inside a table.I thought about doing a checkbox for each type but don't know how to concatenate them into the genre field from a checkbox selection.  There has to be a way to pull it but I just don't know how.

Thanks in advance
John Davy  @Reply  
         
4 years ago
Hi Scott
Take a look at Rick's video on taking attendance. I think it will help you with appending records using a recordset.
HTH
John
Scott Crippen OP  @Reply  
   
4 years ago
Thanks John.  Merry Christmas!
Scott Crippen OP  @Reply  
   
4 years ago
John,

I have done several searches.  "Taking attendance", "attendance" without luck.  Can you locate the video and share the link?

Thanks

After reading my original post I thought it sounds about as clear as mud what I am trying to do.  Let me simplify it some.  I have a listbox with 24 items.  When items are selected, each item goes into a result field on the form (& table) after being concatenated.  Later, on a different form, I am trying to query for a specific >> ONE << of the several items possible in that result field, from the original table.  How do I parse out the individual items?  

From the listbox the concatenated items are formatted  "whatever" & ",_"   .  Is it possible to query for string variables between the comma space?  Left of comma maybe?
Scott Axton  @Reply  
        
4 years ago
Sticking my nose in.
The attendance stuff is started in Access Expert 14 and gone more in depth in Access Expert 15.

I often find a simple "Ctrl-F" in the Microsoft Access Outlines page will give me results the Search feature does not.

I'm having trouble visualizing what you are trying to do but it looks like you're complicating things rather than simplifying them. You probably need to provide some pictures / screen shots to help us see 1. your structure and 2. what you want.

String Functions is what you need to pull data out from with in a string.  Covered even more extensively in Access Expert 25 & on.

If you have completed the Beginner Series covered in the MyOLP Beginner you might want to ask about upgrading to the Expert MyOLP.  I highly advise -  No Hopping around.  Each Expert builds on the previous course.
See the Skipping Levels
Scott Crippen OP  @Reply  
   
3 years ago
Scott,

i am not an expert nor have I signed up for those courses.

On a form which has song titles, artists, year published and lots of other information. I have a list box with music genres on that form.  On the list are things like Pop  Rock  Heavy Metal  Funk  Soul and so forth.  If three items are selected in the listbox, the form concatenates them when I click a button to save them.  They might appear in a field as "Pop, Funk, Soul,"  if those three are selected.  What I want to do later, on a different form, is to pull those items out separately.  I am trying to parse out each item I mean I want to search for songs with Pop as a genre.  This would identify "pop," (how it was concatenated) and find all the songs with that.  If there are multiple genres, like "Pop, Funk, Soul,"  the song should pop out in a search for any of those items.  I cant figure out a query.

It took a while but I finally made this code which seems to work for concatenating;

Private Sub SaveGenreButton_Click()
    Dim varItem As Variant
    Dim strSearch As String
    Dim Task As String
    
    For Each varItem In Me.ListGenreSelect.ItemsSelected
        strSearch = strSearch & Me.ListGenreSelect.ItemData(varItem) & ", "
    Next varItem
    
    If Len(strSearch) = 0 Then
        Task = "select * from ListGenreSelect"
    Else
        strSearch = Right(strSearch, Len(strSearch))
        Task = "select * from ListGenreSelect where([ID] in (" & strSearch & ", " & " ))"
        
        Me.Genre = (strSearch)
    End If
        
End Sub

My question is how to pull them individually from a query search.  The only alternative I can see is to have checkbox for each genre, which I am trying to avoid.  If I did go to check boxes, I would then have to concatenate them individually, which would take a TON of coding to do but getting query results would be simple.

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/22/2026 8:24:26 PM. PLT: 1s