Hi peza,
PMFBI
Click on "Create Query in Design View"
In the Show Table dialog box,
click on your table,
click Add,
click on Add again,
and then click Close.
You should now show 2 copies of your table
in the query designer.
Right-mouse click on the left table
and choose Properties.
In the Alias row, type in
Older
then close the Properties dialog box.
Right-mouse click on the right table
and choose Properties.
In the Alias row, type in
Newer
then close the Properties dialog box.
I believe you want to join them
on the Number field.
Click and hold down on left table's
Number field
and "drag and drop"
over on right table's Number field.
You should now have a (join) line
connecting the 2 tables going
from Older.Number to Newer.Number
fields.
Drag and Drop Name field from
Older table down in to field row
of first column of grid.
Drag and Drop Number field from
Older table down in to field row
of second column of grid.
Drag and Drop Date field from
Older table down in to field row
of third column in grid.
Drag and Drop Name field from
Newer table down in to field row
of fourth cloumn in grid.
Drag and Drop Date field from
Newer table down in to field row
of fifth cloumn in grid.
All that is left to do is set the Date
Criteria. If I understand correctly
you want to show the records (matches)
from Newer table where
Newer.Datefield > Older.Datefield
So...
In Criteria row under Newer.Datefield column,
type in
(using your actual name of the "Datefield"
instead of "Datefield")
Apologies again for butting in.
Good luck,
Gary Walter
peza said:
Thanks for the input, but now I'll show how little I know about Access. I tried to
lay out the five columns I want returned from the original list in Design View. I
then entered the code you laid out under Column D, replacing "TableName" with the
name of my table, and tried to run the query. It said the syntax was incorrect.
Since I obviously don't know nearly enough about this, would you be able to give it
to me in the simplest possible terms - exactly what code goes in which fields, do I
need a duplicate of my original table, how do I lay this out in design view, should I
not have replaced "TableName", and anything else I might not be thinking of?
Thanks a bunch for your help. I'm in way over my head with this.
----- John Spencer (MVP) wrote: -----
SELECT A.[Name], A.[Number], A.[Date],
B.[Number], B.[Date]
FROM Tablename as A INNER JOIN TableName as B
On A.[Name] = B.[Name]
WHERE A.[Date] < B.[Date]
Now, I don't have any idea if that will give you an updatable query.
not quite. I'll probably do a better job explaining if I illustrate what I hope the final results will look like:
Original List:
Column A: Name
Column B: Number
Column C: Date
Query Results:
Column A: Older Name
Column B: Number for Column A
Column C: Date for Column A
Column D: Newer Name (associated number matches number in Column B, newer date than Column C)
Column E: Date for Column D
I realize if I can do this it may result in duplicate entries in Column A
if there is more than one newer match. That's OK. So far the only method that has
come close is by separating into two lists using an arbitrary date (for instance,
everything before 2001 in one list, everything since 2001 in another) and comparing,
but that still leaves everything older to sort through manually.