From: robeito on
hello there!

In my form there is a field "idCountry", but I don't want to see the number,
instead, I want to show the country name, so I changed the control to a
combobox and the rowsource is "select id,name from countryCat"... etc. etc.

It works fine, but there is a problem, when I try to sort the data sheet by
that field (using the right click button of the mouse), actually it is sorted
by the "ID" of the country instead of its name.

I want to see the datasheet sorted by the real names of the countries, not
by its IDs

any sugestions?

thanks in advance
From: Daryl S on
Robeito -

In your "select id,..." statement, add in this at the end:

ORDER BY [name]

Note you should not use "name" for the name of a field - it is a reserved
word and will cause you problems. Until you get it fixed, remember to always
put square brackets around it, including in the SELECT statement.

--
Daryl S


"robeito" wrote:

> hello there!
>
> In my form there is a field "idCountry", but I don't want to see the number,
> instead, I want to show the country name, so I changed the control to a
> combobox and the rowsource is "select id,name from countryCat"... etc. etc.
>
> It works fine, but there is a problem, when I try to sort the data sheet by
> that field (using the right click button of the mouse), actually it is sorted
> by the "ID" of the country instead of its name.
>
> I want to see the datasheet sorted by the real names of the countries, not
> by its IDs
>
> any sugestions?
>
> thanks in advance
From: robeito on
Thanks Daryl:

I must clarify my post:

Actually the data grid shows the information as I spected, but, when I use
the standar right click action of the mouse on the grid (sort A->Z, sort
Z->A, cut, copy paste, filter,...) and use the sort option, the grid is
sorted by the countries ID and that's not what I want, I want the grid sorted
by the alphanumeric name of the country








"Daryl S" wrote:

> Robeito -
>
> In your "select id,..." statement, add in this at the end:
>
> ORDER BY [name]
>
> Note you should not use "name" for the name of a field - it is a reserved
> word and will cause you problems. Until you get it fixed, remember to always
> put square brackets around it, including in the SELECT statement.
>
> --
> Daryl S
>
>
> "robeito" wrote:
>
> > hello there!
> >
> > In my form there is a field "idCountry", but I don't want to see the number,
> > instead, I want to show the country name, so I changed the control to a
> > combobox and the rowsource is "select id,name from countryCat"... etc. etc.
> >
> > It works fine, but there is a problem, when I try to sort the data sheet by
> > that field (using the right click button of the mouse), actually it is sorted
> > by the "ID" of the country instead of its name.
> >
> > I want to see the datasheet sorted by the real names of the countries, not
> > by its IDs
> >
> > any sugestions?
> >
> > thanks in advance