Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help:Sorting Records on Form List Box

Status
Not open for further replies.

RDMRDM

Programmer
Apr 9, 2007
33
US
I have an Access form that shows data from a table called "Contacts". This table has a list of contacts and their information. On the form, I added a "List Box" showing Lastname and Firstname from the contacts table. I added this to allow me to find various contacts in the table by selecting their name. However, the list is not sorting properly. I would like the records in the list box to sort alpha order by "LastName". How should I do this? Currently it's sorting by the ContactID field. I am using Access 03. Thanks in advance for any help.
 
Just go into the 'RowSource' of the List Box and adjust it to sort by whatever you need. You can sort by both Lastname and firstname.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Thanks for the info. My Row Source field currently reads as follows: SELECT Contacts.ContactID, Contacts.LastName, Contacts.FirstName FROM Contacts;


What would I update it to so it sorts alpha order by Lastname and Firstname? Thanks.
 
You could add a sortorder to the query by hand:

SELECT Contacts.ContactID, Contacts.LastName, Contacts.FirstName FROM Contacts Order by LastName;

or open up the query builder at the rowsource (...) and add on order.

Pampers [afro]
Keeping it simple can be complicated
 
How are ya RDMRDM . . .

Copy/paste from below in its place . . .
Code:
[blue]SELECT ContactID, LastName, FirstName FROM Contacts ORDER BY LastName, FirstName;[/blue]


Calvin.gif
See Ya! . . . . . .
 
RDMRDM . . .

Great! [thumbsup2]

BTW: [blue]Welcome to Tek-Tips![/blue] To get great answers and know whats expected of you in the forums be sure to have a look at FAQ219-2884 [thumbsup2]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top