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

sorting in acess with primary and secondary field 1

Status
Not open for further replies.

vaughn9

Technical User
Sep 23, 2001
183
Here is an Access question

sort the database table in ascending order using "Surname" as the primary field and "Lastname" as the secondary field.

How does one do that. I am aware that you can do a primary and secondary sort in excel but how is that done in access.
 
Hi vaughn9,

Do you want to sort the DataSheet View of the Table? If so, ..

In Table Design Mode, select Edit > Properties from the Menu.
Under Order By enter the fields you want to sort on, comma separated.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
The question was to sort a database table by two fields the first field as the primary and the next as the primary. Not to create a report. I know this can be done in a report.

the question is can access perform the function of sorting as primary and secondary on a table.

I am using access 2000 Edit does not have a Properties tab but view does, or if you right click on a field you get properties. I tried order by with the two fields separated by a comma but that does not work and in any case you are right clicking on one field to get the properties tab.

The report wizard has what I think should be done but the question was sort the table.

Just trying to find out if this can be done with the table
 
Sorting on Multiple Fields
can sort by multiple adjacent columns
consider using a second sort field when the primary sort field has duplicate values and you want to control how they’re sorted among themselves
primary sort field is left-most of the sorting field
secondary sort is next sort field to the right, etc.
steps:
1. if necessary, drag columns so they’re adjacent, with primary sort field on the left
2. select both field headers
3. click Sort Ascending or Sort Descending
 
Hi vaughn9,

My apologies. Properties is on the View Menu, not Edit. However you get it, from the menu or by right clicking somewhere, the Table Properties Dialog should allow you to enter multiple Order By fields.

I don't know where in the World you are - maybe your Regional Settings mean you need to use a semi-colon separator. Easiest way to check is to go into Datasheet View and sort on any two adjacent columns as you describe; then return to Design View and look at what has been put in the Order By Box. Then edit it with the column names you want, in the style of what you see.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Access 2000.

Select the table and go to datasheet view.

Then records->filter->Advanced filter/sort

Select the columns you need, and on the sort line decide if ascending/descending.

Then wihout closing that window go to menu records->apply filter/sort

If this is still not what you are after then you will have to create an index containing the fields you need.



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top