Dennis: Because each attorney has their own list (or table) so they
can be easily distinguished.
Lance: I want to be able to view the duplicates to find out which
tables they are in so i can go to the attorneys who have that address
listed.
There's really no need for ten tables. Add an additional field indicating
whose list it is, and write queries that return the addresses for each
individual attorney. Use those queries where you would otherwise have used a
specific table.
That having been said, you can simulate that by creating a UNION query.
Unfortunately, you cannot create UNION queries through the graphical query
builder: you'll have to work explicitly with the SQL that Access creates.
Assuming your tables are named Attorney1, Attorney2 and so on up to
Attorney10, and each has fields PersonName, PersonAddress, PersonCity,
PersonState and PersonZip, create a new query, select only one table
(Attorney1) and drag all of the fields into the grid. Then, switch to the
SQL view (it's under the View menu). You should see something like:
SELECT Attorney1.PersonName, Attorney1.PersonAddress, Attorney1.PersonCity,
Attorney1.PersonState, Attorney1.PersonZip FROM Attorney1
Simply that a litte by removing the Attorney1. in front of each of the field
names, and add a computed field to indicate which attorney's list it is:
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney1" AS WhoseList
FROM Attorney1
Okay, now select that entire query and copy it to the clipboard (Ctrl-C, or
from the Edit menu)
Underneath what's there, type UNION, then paste what you had in the
clipboard (Ctrl-V, or from the Edit menu). You should now have:
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney1" AS WhoseList
FROM Attorney1
UNION
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney2" AS WhoseList
FROM Attorney2
Continue doing that until you've included all ten tables
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney1" AS WhoseList
FROM Attorney1
UNION
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney2" AS WhoseList
FROM Attorney2
UNION
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney3" AS WhoseList
FROM Attorney3
UNION
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney4" AS WhoseList
FROM Attorney4
....
UNION
SELECT PersonName, PersonAddress, PersonCity, PersonState, PersonZip,
"Attorney10" AS WhoseList
FROM Attorney10
Save that query, calling it something like "qryAllLists"
You can now write a query based on that query. Create a new query and select
qryAllLists from the list. Drag all of the fields into the grid, then
convert your query to a Totals query (there's a icon with a sigma on it on
the button bar, or you can select Totals under the View menu). That'll add a
new row to the grid labelled Total:, set to Group By under each field.
Change that Group By to Count under the WhoseList field, put >1 as a
criteria under that field and run the query. You should now see only those
entries that exist in more than one list.
Now, it won't catch where there are differences between the entries. For
example, if it's 123 Main Street for one list, but 123 Main St. on another,
that won't show up as a duplicate.