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

Compare table

Status
Not open for further replies.

jh3016

Programmer
Jun 6, 2003
148
US
I just did an import from a spreadsheet into an Access table.

I was sent another spreadsheet that just updated some of the fields in the records. However, the number of records was different. Now I want to find out what extra records were sent to me.

Is there a way that I can compare the two? In other words, I'm thinking that I would export the second spreadsheet into a table and then compare the two tables. However, I don't know how to do this.

The two tables would be: TableOne and TableTwo.

The fields I would want to compare would be CoNumber. If CoNumber does not exist, I would like an output of the missing CoNumber with it's associated CoName.

Thanks in advance.
 
This sounds like a one time problem, so probably don't want to get into writing major codes or querries. I would sugges just making 1 table and call it what ever you like.

Use these fields

CoNumber
SHeet

Then, open the first spreadsheet, add a column and fill all the records with "1" and highlight the CoNumber and the 1 field, copy, and past append it to the new table.

Then do the same with the second spreadsheet, but make the 1 field say 2 instead. Past append it.

Then, you can write a simple query to see what does not appear in both spreadsheets, like this:

SELECT Table1.CoNumber, Sum(Table1.Sheet) AS SumOfSheet
FROM Table1
GROUP BY Table1.CoNumber
HAVING (((Sum(Table1.Sheet))<3));


This query will show you only items not in both, and the number it gives will be what spreadsheet it came from.

This assumes of course that each spreadsheet only lists each CoNumber once. If it lists them more than once, make the Conumber, and sheet a combined primary key.

ChaZ



Ascii dumb question, get a dumb Ansi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top