List box based on look-up table is automatically sorted

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a list box on a form that is populated from a look up table. I have
typed in the data into the look up form in a specific order but the data gets
automatically sorted to an alphabetical list. How can I prevent this from
happening? Thanks. Steve
 
Steve said:
I have a list box on a form that is populated from a look up table. I have
typed in the data into the look up form in a specific order but the data gets
automatically sorted to an alphabetical list. How can I prevent this from
happening? Thanks. Steve

In the row source for the list box, specify an ordered query rather than
simply the name of the table e.g.

SELECT some_field FROM my_table ORDER BY some_other_field

There is nothing in the design or specification of Access which dictates
that records in a table should be returned in the order that you entered
them. If you want records returned in a certain order, then you MUST always
say so when you query them.
 
Steve

As long as your listbox's source is the table, you get the table's sort
order. Consider using a query against the table to impose the order you
wish, then using the query as the list box's source.
 
Back
Top