If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Adding "Show All" to a combo box.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-09, 18:04
ron_j_m2002 ron_j_m2002 is offline
Registered User
 
Join Date: Dec 2009
Posts: 8
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
Reply With Quote
  #2 (permalink)  
Old 12-08-09, 19:28
ron_j_m2002 ron_j_m2002 is offline
Registered User
 
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
Reply With Quote
Reply

Tags
combo box, select all

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On