423,873 Members | 2,170 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,873 IT Pros & Developers. It's quick & easy.

Sort Two Field Acending Order (Eg:- First_Name& Last_Name) in MS Access

P: 3
Sort Two Field accending Order (Eg:- First_Name& Last_Name) in MS Access
How to sort two fields in Ms Access Data sheet Like following;
First field(First_Name) sort accending and second field(Last_Name) accending according to the first field..

First_Name Last_Name
Anne Androson
Ammei David
Arron Harrisson
Robat Daveson
Aug 2 '18 #1

✓ answered by twinnyfo

IndikaSSinghe,

Welcome to Bytes!

Are you trying to sort a Table or Sort a Query?

If sorting a Table, in the Properties of that Table, set the OrderBy Property to Last Name, First_Name. Make sure the OrderByOnLoad property is set to Yes.

If sorting a Query, at the end of your Query statement, add ORDER BY Last_Name, First_Name.

If you want any field to be sorted in descending order, simply at the keyword DESC after that particular field.

Hope this hepps!

Share this Question
Share on Google+
8 Replies


PhilOfWalton
Expert 100+
P: 1,380
Welcome to Bytes, Indika.

Most forms and reports are based on Queries, and Queries allow you to combine tables, set op sort orders and apply filters so that you only see some of the records.

So, create a Query based on your table, and bring the FirstName and LastName down in that order.
Set both of these to Sort Ascending, and you should get what you want.

Note the order of the fields is important. If you have Last Name before FirstName, then the list of names would be
Anne Androson
Robat Daveson
Ammei David
Arron Harrisson



Hope that gets you started

Phil
Aug 2 '18 #2

twinnyfo
Expert Mod 2.5K+
P: 2,724
IndikaSSinghe,

Welcome to Bytes!

Are you trying to sort a Table or Sort a Query?

If sorting a Table, in the Properties of that Table, set the OrderBy Property to Last Name, First_Name. Make sure the OrderByOnLoad property is set to Yes.

If sorting a Query, at the end of your Query statement, add ORDER BY Last_Name, First_Name.

If you want any field to be sorted in descending order, simply at the keyword DESC after that particular field.

Hope this hepps!
Aug 2 '18 #3

PhilOfWalton
Expert 100+
P: 1,380
@ Twinnyfo

I think the OP wants the fields in FirstName, LastName order. Unusual I agree, but your reply is the other way round - LastName, FirstName

Phil
Aug 2 '18 #4

P: 3
How to Sort According to the First Days field then Total_Mark field

ID First_Name Last_Name Days Total_Mark
1 Indika Dinesh 25863 7
2 Inoka Perera 25997 7
3 Imesh Arun 26057 17
4 Arun Dias 26116 7
5 Susen Lasith 26117 7
6 kumar Perera 26713 21
7 Mahela Jayawardane 27567 20
Aug 2 '18 #5

twinnyfo
Expert Mod 2.5K+
P: 2,724
IndikaSSinghe,

You have not asked a question in your last post. However, if you want to change sorting options, just follow the same principles already described here on this thread.

If you want your field to display in the order shown, but sort in a different order, simply add the sorting field after the other fields and uncheck the check box to have that field displayed. Then set the sort order as described above.
Aug 2 '18 #6

P: 3
Thanks, UR Answer is also the Best answer for my question.
Aug 2 '18 #7

PhilOfWalton
Expert 100+
P: 1,380
There is no point in asking further questions until you understand and have implemented the answers that Twinnyfo & Phil gave you.

If you have understood that, please let us know. If so, you can use the same method for the Days & TotalMarks fields.

If you haven't understood our replies, ask for further amplification, don't go on asking a slightly different question.

Phil
Aug 2 '18 #8

NeoPa
Expert Mod 15k+
P: 31,123
PhilOfWalton:
There is no point in asking further questions until you understand and have implemented the answers that Twinnyfo & Phil gave you.
Actually, no point in asking further questions in the same thread generally. Exceptions may be simple clarification questions, but in general each thread has one main question only.
Aug 2 '18 #9

Post your reply

Sign in to post your reply or Sign up for a free account.