S
Silvio
I have a code (se below) that will populate a combo box (unbounded) using the
“columns headings†name from a query (qryUsers). The question I have is: how
can I sort (Ascending) the data in the combo box? Right now, it appears that
the sorting order is the same as the columns order (left to right) in the
query. For example, if the first column in the query is called ColumnA, then
follows ColumnC, then ColumnB and so on. With this example, the data in my
combo box shows as:
ColumnA
ColumnC
ColumsB
What I want to see is:
ColumnA
ColumnB
ColumnC
Thank you folks.
------- Code ------ on form open
Dim curDatabase As Object
Dim strColumnsNames As String
Dim qryUsers As Object
Dim fldColumn As Object
Set curDatabase = CurrentDb
Set qryUsers = curDatabase.QueryDefs("qryUsers")
For Each fldColumn In qryUsers.Fields
strColumnsNames = strColumnsNames & fldColumn.Name & ";"
Next
cboColumnNames1.RowSource = strColumnsNames
“columns headings†name from a query (qryUsers). The question I have is: how
can I sort (Ascending) the data in the combo box? Right now, it appears that
the sorting order is the same as the columns order (left to right) in the
query. For example, if the first column in the query is called ColumnA, then
follows ColumnC, then ColumnB and so on. With this example, the data in my
combo box shows as:
ColumnA
ColumnC
ColumsB
What I want to see is:
ColumnA
ColumnB
ColumnC
Thank you folks.
------- Code ------ on form open
Dim curDatabase As Object
Dim strColumnsNames As String
Dim qryUsers As Object
Dim fldColumn As Object
Set curDatabase = CurrentDb
Set qryUsers = curDatabase.QueryDefs("qryUsers")
For Each fldColumn In qryUsers.Fields
strColumnsNames = strColumnsNames & fldColumn.Name & ";"
Next
cboColumnNames1.RowSource = strColumnsNames