By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,676 Members | 1,636 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,676 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
"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

P: n/a
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.