Excel VBA order of data in ComboBox

  Heefie 16:01 26 May 2008

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
.AddItem KA_RS_Leagues![League_Name]
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 2008

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

  Heefie 16:38 26 May 2008

... 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.

Elsewhere on IDG sites

The Evil Within 2 review-in-progress

InVision Studio takes on Adobe XD and Sketch

iPhone X news: Release date, price, new features & specs

Comment transformer un iPhone en borne Wi-Fi ?