Good afternoon, ladies and gentlemen. Now I am doing a term paper, but, unfortunately, I can’t figure out one thing. 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. Records (genres) for one song can be many. When selecting a particular song in the first subform, the second one should display all the entries, or rather, only a list of genres with the same name. I compiled the following query:

SELECT Genre FROM [List of Songs] WHERE Title = songName

where songName = Me! Name.Text

However, I can not figure out how to transfer the resulting list of genres to the second subform. I tried several options, but there was always a message stating that the entered expression contained an invalid reference to the Form property. Please tell me how you can display it

  • Have you tried to read the list with a request to the RecordSet, and transfer it to the next form? You can try RecordSet to read into an array and transfer it. - iluxa1810
  • I have a problem with the transfer of my request to the RecordSource of the second child form with genres. I do not understand how this can be done. I tried to pass through Parent (something like Me! Parent! [Genres] .Form.RecordSource), and in several other ways, but I constantly got an error - JasperJasy

1 answer 1

The record source 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 first.

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