Get a list of genres from the database in the accessory


Good day, gentlemen. Now I'm doing my term paper, but, unfortunately, I can't figure out one point. I have a database in access. There is a form on which there are two children in relation to it, which take data from one table containing the name of the song and the genre. There can be many entries (genres) for one song. When you select a specific song in the first subform, the second should display all records, or rather, only a list of genres with the same name. I made the following query:

SELECT Genre FROM [Song List] WHERE Title = songName

where songName = Me! Title.Text

However, I cannot figure out how to pass the resulting list of genres to the second subform. I tried several options, but I kept getting a message stating that the expression I entered contains an invalid reference to the Form property. Please tell me how you can display it


The Recordsource for the second subform should be something like this:

SELECT Жанр FROM [Список песен] WHERE Название = Forms![Главная Форма]![Жанры].Form![Название]

And add the Requery of the second subform to the Current event of the first

You can also do it without any code at all, if you make the second level of nesting of subforms with the built-in ability to link the master with the subform. Those. first we draw a form for songs with a subordinate genre form, and then we insert this form as a subform in your main form, linking the subforms through the Link Master Fields and Link Child Fields properties (sorry, there is no Russian version at hand)

Scroll to Top