PC Review


Reply
Thread Tools Rate Thread

combobox sorting

 
 
chriske911
Guest
Posts: n/a
 
      5th Dec 2006
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


 
Reply With Quote
 
 
 
 
Al Campagna
Guest
Posts: n/a
 
      5th Dec 2006
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"
> .ColumnWidths = "0;3;0"
> .ListWidth = 1701
> .Width = 1701
> End With
> tglLUC.Caption = "NUMBER"
> End If

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"chriske911" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>



 
Reply With Quote
 
chriske911
Guest
Posts: n/a
 
      6th Dec 2006
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:


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


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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting combobox elements Ken Warthen Microsoft Excel Programming 4 19th Mar 2010 03:54 PM
Sorting combobox Lars Brownies Microsoft Access 4 31st Jan 2010 03:08 PM
sorting a combobox =?Utf-8?B?YW1iZXI=?= Microsoft VB .NET 2 13th May 2004 08:32 PM
Re: Sorting in a ComboBox keepitcool Microsoft Excel Programming 1 26th Aug 2003 12:06 AM
Sorting in a ComboBox Michael Microsoft Access Forms 2 20th Aug 2003 12:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:50 AM.