combobox sorting

C

chriske911

I have a combobox which can be triggered by a toggle button to show
either a customer's number or the customer's name
off course there is an ID field behind the screens so I can jump to the
customer's details

since I hate sending data over the network if it is not really
necessary I toggle by setting the visible columns of that combobox
like this:

If tglLUC.Caption = "NUMBER" Then
With cmbLUC
.ColumnWidths = "0;0;8"
.ListWidth = 6804
.Width = 3402
End With
LUC = True
tglLUC.Caption = "NAME"
Else
With cmbLUC
.ColumnWidths = "0;3;0"
.ListWidth = 1701
.Width = 1701
End With
tglLUC.Caption = "NUMBER"
End If

but the default sort order is by number and so the names are not sorted
alphabetically
can I change the sortorder of this list without having to retrieve it
from the backend?

thnx
 
A

Al Campagna

Chris,
Have you tried creating 2 SQL statements. One for Sort1 and one for Sort2.
Then, set the combo RowSource to the appropriate SQL, and then change your combo column
widths.
If tglLUC.Caption = "NUMBER" Then
With cmbLUC
.RowSource = "SQL 1 statement here"
.ColumnWidths = "0;0;8"
.ListWidth = 6804
.Width = 3402
End With
LUC = True
tglLUC.Caption = "NAME"
Else
With cmbLUC
.RowSource = "SQL 2 statement here"
 
C

chriske911

Ken Sheridan wrote :
Even if you change the RowSource property of the control I think you'll find
you have requery it, which rather defeats what you want to achieve. The
simplest solution would be to have two superimposed combo boxes and toggle
the Visible property of each to True or False with your button.
If the combo box is unbound you should ensure that the values of the two
controls are synchronized in the AfterUpdate event procedure of each. If its
bound then the value of the hidden bound control will be automatically
updated of course.
Ken Sheridan
Stafford, England
"chriske911" wrote:

dang, thnx to both
I guessed as much that it wasn't possible since I couldn't find a sort
property for a combobox control

grtz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top