Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2009
    Posts
    8

    Unanswered: Adding "Show All" to a combo box.

    Ive been looking all over trying to figure out how to have a select all at the top of a combo box.

    What I have is a combobox Combo5 with a row source of
    Code:
    SELECT artist_id, artist_name FROM tblArtists ORDER BY artist_name;
    A text box with a row source of
    Code:
    SELECT [tblTracks].title, [tblTracks].length, [tblGenres].music_genre_name, tblBitrates.Bitrate, [tblTracks].date_of_creation, [tblArtists].artist_name FROM tblBitrates INNER JOIN (tblGenres INNER JOIN (tblArtists INNER JOIN tblTracks ON [tblArtists].artist_id=[tblTracks].artist_id) ON [tblGenres].music_genre_id=[tblTracks].music_genre_id) ON tblBitrates.bitrate_id=[tblTracks].bitrate_id WHERE (((tblArtists.artist_id)=Forms![frmSearch]!Combo5)) ORDER BY [tblTracks].title;
    And VBA code in the After update of the combo box
    Code:
    Private Sub Combo5_AfterUpdate()
    
        Me.lstResults.Requery
    
    End Sub
    What I would like to have happen is a select all at the top of the combo box that is the default selection, and when its selected all records from the query are show.

    Ive tried a bunch of Unions and such that I have seen online and cant get it to work.

    Any suggestions?

    Thanks
    Ron

  2. #2
    Join Date
    Dec 2009
    Posts
    8
    OK..
    Figured this out.

    Changed my select statement in the combo box to
    Code:
    SELECT artist_id as filter, artist_name FROM tblArtists UNION SELECT "*" As Filter ," All" As artist_name FROM tblArtists ORDER BY artist_name;
    I had tried this before but it didnt work.
    What I did was add Like to my text box select criteria

    Code:
    SELECT tblTracks.title, tblTracks.length, tblGenres.music_genre_name, tblBitrates.Bitrate, tblTracks.date_of_creation, tblArtists.artist_name FROM tblBitrates INNER JOIN (tblGenres INNER JOIN (tblArtists INNER JOIN tblTracks ON tblArtists.artist_id=tblTracks.artist_id) ON tblGenres.music_genre_id=tblTracks.music_genre_id) ON tblBitrates.bitrate_id=tblTracks.bitrate_id WHERE (((tblArtists.artist_id) Like [Forms]![frmSearch]![cmbArtist])) ORDER BY tblTracks.title;
    Just figured I would post this in case anyone else has this same problem..

    Ron

Tags for this Thread

Posting Permissions

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