I have an Excel spreadsheet provided as a report, when really its more of a database, with the row number acting as primary key. I need to compare some columns in this set with a different set of records from an Access 2007 database. To make matters more complicated, this needs to be done automatically, without user input, on a regular schedule.
What is the best way to get the data out of the spreadsheet, and what is the best way to run the comparison. As for getting data out of the spreadsheet, ACEDAO seems the best option, since this is Excel 2007, but MSDN has no information I could find on how to query Excel using DAO/ACEDAO, only to export to Excel using DAO/ACEDAO. As for running the comparison, beyond comparing each column of each entry, I can’t figure out a better way to do it.
If memory serves, you can create a linked table to an Excel spreadsheet. Once it is linked into Access, you can treat it like any other table.
The query to do the comparison looks something like this (see picture below). It will return rows from the Excel spreadsheet that do not match (right-click on the picture and save it to your computer for a clearer view).
As far as the automation goes, if you’re willing to leave a copy of Access running you can set up a Timer in a form. If not, you will have to use Office Automation. See here for a “hello world” example in C#:
http://rnarayana.blogspot.com/2008/02/access-2007-office-automation-using-c.html