how do i get the options in a list box to be in ascending order?

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

Guest

I've set up a list box that is linked to another table in the database and
needs to be updated frequently. How can i get the form to update
automatically and be in ascending order?
 
Change the Row Source property of the list box to a SQL statement and use
the ORDER BY clause ...

SELECT SomeField FROM SomeTable ORDER BY SomeField.
 
How do I change it to a SQL statement

Brendan Reynolds said:
Change the Row Source property of the list box to a SQL statement and use
the ORDER BY clause ...

SELECT SomeField FROM SomeTable ORDER BY SomeField.
 
Stressed said:
I've set up a list box that is linked to another table in the
database and needs to be updated frequently. How can i get the form
to update automatically and be in ascending order?

You're post is a bit confusing. ListBoxes are not "linked". Do you mean that
it is using another table as its RowSource? If so then instead of merely using
the name of the table for the RowSource property, use a SELECT query based on
the table and in that query set a sort order on the desired fields.

Then you state that you want the "form to update automatically". Do you mean
the form or the ListBox on the form? To get the ListBox to reflect changes that
have occurred in its RowSource table you need to issue a Requery command on it
such as...

Me.ListBoxName.Requery

Where you would issue that line of code though depends on when the table will
have updates performed on it.
 
Brenda thank you so much. You've been so helpful. Do you know how I can get
it to automatically update. when I save something to the linked table?
 
Back
Top