Results 1 to 12 of 12
  1. #1
    ringy9 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    6

    Filling Junction Table With ID's from 2 other Tables

    Windows 10, Access Office 365

    Hi everyone.

    Just joined forum in the hope I can learn as much as possible form the members of this group.



    I have created 3 tables in Access as a Music database. The Tables I have created are:

    tArtist: PK ArtistID , Artist

    tArtist_Song: PK ArtistID , PK SongID

    tSongs: PK SongID , Song_Title

    Both the tArtist and tSongs are filled with records and the ID's are autonumber. I would like to fill the tArtist_Song Table with the ID's from the other 2 Tables.

    I have attempted to Join this information, but no amount of manipulating the data, or searches I have Googled have helped me with this.

    In the Design View I have attached, the Query will give the ArtistID and SongID as headings but of course doesn't fill the table with records.

    I would be most thankful for any assistance.
    Attached Thumbnails Attached Thumbnails AccessJoins.png  

  2. #2
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    No quick way to do that with a query. No way for the query to know how to relate an artist to a song or a song to an artist.

    Have a look at this to see how a form (with keyboard input from you) can help. The example is relating club members to events in one form and events to club members in the other.

    The side by side listboxes are probably the fastest but should be the other way around, with the combobox selecting the artist and then the listboxes assigning the songs. That form is pretty heavy with VBA.

    Simpler is the form/subform setup. The member is the main form with the events for that member in the subform. Very little VBA, and has the desired parent/child setup.

  3. #3
    ringy9 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    6
    Thank you davegri for your kind reply. I will investigate your file with interest.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    In order to appropriately associate artists with songs requires good old tedious boring data entry. I am sure Dave's examples cover the variations of data entry forms.

    Unless you want to develop code that could pull this from mp3 file metadata. https://social.msdn.microsoft.com/fo...es-mp3-wma-etc
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ringy9 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    6
    So davegri from what I gather from your forms is that the input for your Junction table was input manually via the form is that correct? I'm thinking I'd be happy with the main/subform type setup with the Artist in one and The Song Titles in the subform. Does this input update the various tables? Can you also add new records via the form as well. Sorry for all the questions but there is a lot going on with the forms and I don't have to much knowledge of VBA if that is required.

  6. #6
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi
    You may find the attached example a little easier to follow.

    Study the Relationships and then break down the Forms.
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  7. #7
    ringy9 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    6
    Thank You mike60smart I will certainly check it out as well as your link

  8. #8
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Quote Originally Posted by ringy9 View Post
    So davegri from what I gather from your forms is that the input for your Junction table was input manually via the form is that correct? I'm thinking I'd be happy with the main/subform type setup with the Artist in one and The Song Titles in the subform. Does this input update the various tables? Can you also add new records via the form as well. Sorry for all the questions but there is a lot going on with the forms and I don't have to much knowledge of VBA if that is required.
    Click image for larger version. 

Name:	schedule.png 
Views:	30 
Size:	28.5 KB 
ID:	47238

    Answer to all is YES.
    Have you tried to use the form?
    Add a new member
    Add events to a member record
    Delete a member
    Add a new event

    All of these update the tables.

    If you upload your DB, I can adapt the form to your data.

    Mike60smart shows that the arrangement can be assigning members (artists) to events (songs) rather than assigning events (songs) to members (artists). In either case the result in the 3 tables is exactly the same.

  9. #9
    ringy9 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    6

    Upload Music Database

    Database1.zip

    Hi Guys, as suggested I have attached the zip file for my database.(Hope it has actually attached )

    I'm guessing I'm in a different timezone (Melbourne,Australia) so I didn't get a lot of time to investigate the files sent to me, but I am doing so.

    Thanks again for your generous help and support.

  10. #10
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    I'm guessing I'm in a different timezone (Melbourne,Australia
    I visited "Malbin" on the best vacation of my life. Not helpful wrt a solution for your post, but I just wanted to say if I couldn't live in the great Cannuk land, AU would be a great alternate choice!
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Quote Originally Posted by ringy9 View Post
    Database1.zip

    Hi Guys, as suggested I have attached the zip file for my database.(Hope it has actually attached )

    I'm guessing I'm in a different timezone (Melbourne,Australia) so I didn't get a lot of time to investigate the files sent to me, but I am doing so.

    Thanks again for your generous help and support.
    Cleaned up the tables. Removed about 1500 duplicate artist names.
    All the song titles had a leading space and some had leading open parens, which I removed. (also a couple of hundred dupes here)

    The attached DB uses the main/subform approach. I added several forms, a couple of reports and some VBA.
    I think it will give you a solid starting position by giving you a method to maintain your tables.

    Click image for larger version. 

Name:	associations.png 
Views:	21 
Size:	24.6 KB 
ID:	47243

    Edit:
    Also added referential integrity to tables and cascade deletes so that you don't get hassles in the event of an Artist or Song deletion.
    Last edited by davegri; 02-06-2022 at 11:24 PM. Reason: see edit

  12. #12
    ringy9 is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    6
    O Wow! Dave Thank you kindly for your efforts. Time for me to get to work

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 08-29-2018, 09:10 AM
  2. Replies: 24
    Last Post: 05-26-2017, 01:06 AM
  3. Replies: 13
    Last Post: 05-10-2017, 12:43 AM
  4. Replies: 1
    Last Post: 06-24-2014, 01:31 PM
  5. Populate Junction Table related to 3 Tables
    By Daoud1987 in forum Access
    Replies: 5
    Last Post: 12-11-2013, 12:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums