Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Todd
Guest
 
Posts: n/a
#1: Nov 13 '05
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




Bradley
Guest
 
Posts: n/a
#2: Nov 13 '05

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


"Todd" <todd.penland@penland.net> wrote in message
news:yEdSc.761$qB1.674@fe25.usenetserver.com[color=blue]
> 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.[/color]


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


Todd
Guest
 
Posts: n/a
#3: Nov 13 '05

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


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_junk_mail@address.com> wrote in message
news:KgeSc.45444$K53.8381@news-server.bigpond.net.au...[color=blue]
> "Todd" <todd.penland@penland.net> wrote in message
> news:yEdSc.761$qB1.674@fe25.usenetserver.com[color=green]
> > 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.[/color]
>
>
> 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
>
>[/color]



Closed Thread


Similar Microsoft Access / VBA bytes