Excel VBA order of data in ComboBox

  Heefie 16:01 26 May 08
Locked

Hi all, hopefully an easy one ... I'm using VBA in Excel 2003 & am loading a ComboBox from an Access 2003 database as follows :

With KA_Form.KA_ComboBox1
.Clear
Do
.AddItem KA_RS_Leagues![League_Name]
KA_RS_Leagues.MoveNext
Loop Until KA_RS_Leagues.EOF
End With

It works fine, if, for instance, I have 3 entries, "A", "C" & "E", they will display in the ComboBox in that order, exactly as I want.

If I then Add "B" or "D", or if I delete "C" and re-Add "C", the next time that I look at the ComboBox, they are not in order, it will list "A", "E" and then the newly added "B", "C" or "D" ...

Is it possible to make these display in Alphabetical order, EVERY time they are listed, regardless of their order in the Database (The database consists of 2 fields only, an AutoNumber and the Alphabetical entry, League_Name) ?

I think that all makes sense .......

  VoG II 16:05 26 May 08

Here's some code click here that sorts values in a ComboBox.

  Heefie 16:38 26 May 08

... so re-thought it, and asual, it was staring me in the face ... I have the option of ORDER BY [League_Name] when I set up the RecordSet !!!

Thanks though, VoG, it helped in a round-about sort of way !!!

This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

20 groundbreaking 3D animation technologies coming to Siggraph 2017

iPad Pro 12.9 vs Surface Pro 5