Sort data based on sort from another table

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

I have a table whose data I would like to sort based on the sorting of
another table.

In one table I have a column of IDs. There is also a column of dates
used to sort the data by the date on which it was recorded.

In another table I have a column of the same IDs (but not necessarily
all of them or in the same order), as well as some other data recorded
at another time.

I would like to sort the data in this second table in the order the
first table was sorted without having to create another column with the
same date entries as the first table. In other words, sort the data in
the second table by the order of IDs in the first. Any ideas?

Thanks!
 
Daniel said:
I have a table whose data I would like to sort based on the sorting of
another table.

In one table I have a column of IDs. There is also a column of dates
used to sort the data by the date on which it was recorded.

In another table I have a column of the same IDs (but not necessarily
all of them or in the same order), as well as some other data recorded
at another time.

In that case, you really don't need this second table. Just create a query
based on the first table, that returns just the records you want. There is
no need to create a table for this. You can specify in the criteria row,
which IDs you want, and also you can specify the sort order on any field.
 
I guess I should have explained more about what I'm trying to do. The
first table contains information about each ID/person. The second
table has additional data they enter. I want to import *all* the data
in Excel. The data from both tables will be next to each other, so I
want the data entered by each person to line up with their info. I can
certainly run a query, but how would I change the order that way?
 
If I understand you - table1 with dates and IDs - table2 with IDs and other
data.

You want the 2nd table displayed in the order that the IDs of table1 when
sorted by date order - like below --
Table1
Date ID
1/1/05 23
1/2/5 22
2/1/5 11
2/2/5 44

Table2
ID fields1 fields2
23 gg rr
22 ee xc
11 we fg
44 de xc

If this is what you want then create a query with both table joined on ID.
Pull down the date field and select Ascending as the sort order. You can
click the box to turn off the display of the date field. Pull down the rest
of the fields you want to display.
 
I guess I should have explained more about what I'm trying to do. The
first table contains information about each ID/person. The second
table has additional data they enter. I want to import *all* the data
in Excel. The data from both tables will be next to each other, so I
want the data entered by each person to line up with their info. I can
certainly run a query, but how would I change the order that way?

Queries have an Order By clause. You can select which fields you want
in the query, in what order; and you can sort Ascending by multiple
fields.

If you're assuming that you must have the data in a Table to export to
Excel, you don't - you can export perfectly well from a Query.

John W. Vinson[MVP]
 
Ah yes! Forgot about JOIN... don't use access often enough to
remember these things. Thanks a lot!
 
Back
Top