Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    4

    Unanswered: populating list boxes hymnal to name of song

    Forum name of song to Hymnal.
    I have a forum for name of song to Hymnal for the coding
    Option Compare Database

    Private Sub Author_AfterUpdate()
    On Error Resume Next
    [Name of Song].RowSource = " "
    [Name of Song].RowSource = "SELECT HymnalSonginfo.[Name of Song],HymnalSonginfo.[Hymnal Name] " & _
    ", HymnalSonginfo.[Hymnal Song Number] " & _
    "FROM HymnalSonginfo " & _
    "WHERE HymnalSonginfo.[Author and key]= " & """" & [Author].Text & """" & _
    " ORDER BY 1,2,3;"
    On Error Resume Next
    End Sub

    Private Sub nameofsong2_AfterUpdate()
    On Error Resume Next
    [hymnalauthorpage].RowSource = " "
    [hymnalauthorpage].RowSource = "SELECT HymnalSonginfo.[Hymnal Name],HymnalSonginfo.[Author and key] " & _
    ", HymnalSonginfo.[Hymnal Song Number] " & _
    "FROM HymnalSonginfo " & _
    "WHERE HymnalSonginfo.[Name of song]= " & """" & [Nameofsong2].Text & """" & _
    " ORDER BY 1,2,3;"
    On Error Resume Next

    End Sub
    However I want to create one to go from hymnal to name of song
    Which fields or control source would I have to switch around?

    SELECT DISTINCT HymnalSonginfo.[Author and Key] FROM HymnalSonginfo;

    Is their any other way because the current forum now populates from name of song to Hymnal,
    All I want the next forum to go to is hymnal to name of song.

    Do you know of any way around this?

    A easier way or a coding program that will fill in the tables for the Select Distinct to and From part.

  2. #2
    Join Date
    May 2009
    Posts
    258
    You could do something like the following:
    Code:
    [hymnalsongpage].RowSource = "SELECT HymnalSonginfo.[Name of Song],HymnalSonginfo.[Author and key] " & _
    ", HymnalSonginfo.[Hymnal Song Number] " & _
    "FROM HymnalSonginfo " & _
    "WHERE HymnalSonginfo.[Hymnal Name]= " & """" & [HymnalName].Text & """" & _
    " ORDER BY 1,2,3;"
    Ax

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •