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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting records in a table 1

Status
Not open for further replies.

kjv1611

New member
Jul 9, 2003
10,758
US
I have a table in my database entitled, tblMonth which holds the names of most months, except for where quarters fall. The data goes January, February, 1st Quarter, April, May, 2nd Quarter, July, August, 3rd Quarter, October, November, 4th Quarter. I also have a Month ID field in the table, where the ID is 1 for January through 12 for 4th Quarter. I want the information to sort according to the Month ID field, thus January would show up first in a form control, and 4th Quarter would show up at the bottom, or last in the control (combo box). Here is what I have the Order By property in the table set to: tblMonth.[Month ID]

Anyone have any ideas as to what is wrong with this, or if there is a better way to sort the info? I don't really care how it is sorted on the table itself; I just want it to sort in the combo box on the form which is pulling the info from the tblMonth table.

Currently, the table is sorted by the Month ID field, but it is not sorting in the combo box on my form. So the real question is: how do I force the data in the Combo Box, cmbMonth, to sort by the Month ID field of the table?

Any input on this would be greatly appreciated.
Stephen
 
Well, in case anyone comes accross this posting. I found the answer in another posting. Simply right-click the control, select properties, and find the Data tab, then the "Row Source" option. Select that option, then click the button on the right with the 3 dots (build button). It may ask if you wish to envoke the query builder, just say "yes", go and select the fields (same as if doing a query separately), and sort them according to your desires (it's very self explanatory, even if you've never dealt with queries). Once you finish, close the query builder window, and Access will say something about you changed the SQL statement, do you want to continue, just select "yes" or "okay", and move on. Your combo box list should then be sorted appropriately. For more details, see the thread entitled "Sorting a Combobox List Having a Table as its Source"... [blue]702-751542[/blue]. See posting by Nigel. I gave him a star on that one, b/c was very helpful to me.
 
Well done Stephen and a commendation for coming back to your own thread and posting the solution you found for the benefit of others.

For that you too get a star from me. :)





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top