469,273 Members | 1,794 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,273 developers. It's quick & easy.

Sorting form records on the unbound column in a combo box on the form

Hi. I want to sort the records on my form (using either a continuous form
or a
datasheet) by the unbound "description" column in a combo box on the form
(or in the datasheet.) Here's a rough text representation of what I'm
talking about

FORM

Item Number Description Category
(text box) (text box) (combo box - 2 columns)

1001 Item 1 Col1=100 Col2=CategoryName3
1002 Item 2 Col1=101 Col2=CategoryName4
1003 Item 3 Col1=102 Col2=CategoryName1
1004 Item 4 Col1=102 Col2=CategoryName1
1005 Item 5 Col1=103 Col2=CategoryName2

So..when the form loads, it is sorted by the Item Number. I want my users
to be able to sort by Category as well by clicking a command button. If I
only reference the Category column in the "OrderBy" property, it will sort
on the first column in the combo box (which is invisible to the user) and
not on the text in the second column. That's what I'm trying to alter
programatically - to sort on the text (as the "Sort Ascending" and "Sort
Descending" commands do when you manually apply the sort order.

Thanks again to anyone who might be able to help.

Todd

Nov 13 '05 #1
2 3245
"Todd" <to**********@penland.net> wrote in message
news:yE***************@fe25.usenetserver.com
Hi. I want to sort the records on my form (using either a continuous
form or a
datasheet) by the unbound "description" column in a combo box on the
form (or in the datasheet.) Here's a rough text representation of
what I'm talking about

FORM

Item Number Description Category
(text box) (text box) (combo box - 2 columns)

1001 Item 1 Col1=100
Col2=CategoryName3 1002 Item 2
Col1=101 Col2=CategoryName4 1003 Item 3
Col1=102 Col2=CategoryName1 1004 Item 4
Col1=102 Col2=CategoryName1 1005 Item 5
Col1=103 Col2=CategoryName2

So..when the form loads, it is sorted by the Item Number. I want my
users to be able to sort by Category as well by clicking a command
button. If I only reference the Category column in the "OrderBy"
property, it will sort on the first column in the combo box (which is
invisible to the user) and not on the text in the second column.
That's what I'm trying to alter programatically - to sort on the text
(as the "Sort Ascending" and "Sort Descending" commands do when you
manually apply the sort order.

Are you talking about the form or the combobox?

Just replace the recordsource/rowsource with a new SQL statement/query
sorted however you like.
--
regards,

Bradley
Nov 13 '05 #2
I'm talking about sorting the records on the form. I know how to sort the
values in the combo box but that's not what I'm trying to do. I want to be
able to sort the records on the form based on the visible "text" value in
the second, unbound column of the combo box.

"Bradley" <no**********@address.com> wrote in message
news:Kg******************@news-server.bigpond.net.au...
"Todd" <to**********@penland.net> wrote in message
news:yE***************@fe25.usenetserver.com
Hi. I want to sort the records on my form (using either a continuous
form or a
datasheet) by the unbound "description" column in a combo box on the
form (or in the datasheet.) Here's a rough text representation of
what I'm talking about

FORM

Item Number Description Category
(text box) (text box) (combo box - 2 columns)

1001 Item 1 Col1=100
Col2=CategoryName3 1002 Item 2
Col1=101 Col2=CategoryName4 1003 Item 3
Col1=102 Col2=CategoryName1 1004 Item 4
Col1=102 Col2=CategoryName1 1005 Item 5
Col1=103 Col2=CategoryName2

So..when the form loads, it is sorted by the Item Number. I want my
users to be able to sort by Category as well by clicking a command
button. If I only reference the Category column in the "OrderBy"
property, it will sort on the first column in the combo box (which is
invisible to the user) and not on the text in the second column.
That's what I'm trying to alter programatically - to sort on the text
(as the "Sort Ascending" and "Sort Descending" commands do when you
manually apply the sort order.

Are you talking about the form or the combobox?

Just replace the recordsource/rowsource with a new SQL statement/query
sorted however you like.
--
regards,

Bradley


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sean | last post: by
1 post views Thread by Jimmy Stewart | last post: by
2 posts views Thread by Mark Roughton | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.