I have a combo box that looks up the reports available in the database. I saw a way of making this dynamic in a VBA book with the following code:
Private Sub Form_Load()
Dim objAO As AccessObject
Dim objCP As Object
Dim strValues As String
Set objCP = Application.CurrentProject
For Each objAO In objCP.AllReports
strValues = strValues & objAO.Name & ";"
Next objAO
lstReports.RowSourceType = "value list"
lstReports.RowSource = strValues
End Sub
It was taking the names from a table and as new reports were added, I had to constantly update the table. This code works great. Only problem is the list in the combo is not in alphabetical order. How can I set the combo to sort??
Thanks!
Susan
Private Sub Form_Load()
Dim objAO As AccessObject
Dim objCP As Object
Dim strValues As String
Set objCP = Application.CurrentProject
For Each objAO In objCP.AllReports
strValues = strValues & objAO.Name & ";"
Next objAO
lstReports.RowSourceType = "value list"
lstReports.RowSource = strValues
End Sub
It was taking the names from a table and as new reports were added, I had to constantly update the table. This code works great. Only problem is the list in the combo is not in alphabetical order. How can I set the combo to sort??
Thanks!
Susan