Compare and update table with data from multiple files (1 Viewer)

sxschech

Registered User.
Local time
Yesterday, 18:37
Joined
Mar 2, 2010
Messages
792
Apologies if this has been answered elsewhere, haven't used the right search term?
I'm going to receive multiple copies of an excel file. The same sheet was emailed to several people. They will fill out and email back. In general, I think it will be straightforward, but thinking about it, seems risky under various scenarios to simply run an update query since may wipe out data from original table or from person A getting replaced with person B file and would like suggestions. For now my thought process is: as I receive the spreadsheet link in and then view a query that joins the two tables (the access table and the linked table containing the updates), query shows only the rows where data are null in original or <>. If the new data looks like is ok, then run an update query to replace the old data. Repeat steps with each file that is received. For example Document Number 124 shows open, Person A sends me file indicating Document Number 124 is now closed, and table gets updated to reflect that change. Person B sends file, obviously, that copy still shows open, so we don't want to change 124 back to open. Do I need to add more columns to the table to indicate when the data got updated and the source of that update so I know not to change closed back to open? Another possibility that could happen - Person B sends back and says 124 is pending closure, so then I will have to get confirmation about whether to use Person A's response or Person B's. Would there be a vba solution, recordsets or something to assist in the process? There are two columns that are going to be updated. Below is the query I am setting up to screen the data when it arrives.

Code:
SELECT tblLetters.DocumentNo, tblLetters.Originator, [LETTERSNT].Originator, tblLetters.BIStatus, [LETTERSNT].[BI Status], 
tblLetters.ResponseExpected, [LETTERSNT].Response
FROM [LETTERSNT] INNER JOIN tblLetters 
ON [LETTERSNT].[Document No] = tblLetters.DocumentNo
WHERE ((([LETTERSNT].[BI Status])<>[tblLetters].[BIStatus] Or [tblLetters].[BIStatus] Is Null) 
AND (([LETTERSNT].[BI status]) Is Not Null)) OR ((([LETTERSNT].Response)<>[tblLetters].[ResponseExpected] 
Or [tblLetters].[ResponseExpected] Is Null) 
AND (([LETTERSNT].response) Is Not Null));
 

Cronk

Registered User.
Local time
Today, 11:37
Joined
Jul 4, 2013
Messages
2,771
You probably have not got a reply before mine because it is difficult to read your question. Use some paragraphing in future.

Yes it is risky importing from spreadsheets where the input is coming from multiple sources, particularly if the spreadsheet is not mailed down, preventing the user from making formatting changes or different data formats.

I had an assignment once of combining in excess of a hundred spreadsheets from an enterprise survey. I spent double digits multiples of import time, setting up checks on the data to detect such things as inserted columns/rows, text included in numeric/date columns ie "about 2009" instead of 2009 or "from March to June 2011"

I was starting off with tables with no records and appending data. In your case in updating data, you need to have some key, matching a record in your table with the data in the spreadsheet. FirstName/LastName might not be enough.

Also keep in mind typos disrupting matches.

Good luck.
 

sxschech

Registered User.
Local time
Yesterday, 18:37
Joined
Mar 2, 2010
Messages
792
Thanks Cronk. Sorry post was poorly formatted (question and layout). For now, my plan(which I tested with some sample data) is to import each data file one by one into a temp table and (delete after processed), then I will use a simple continuous form with an "Update" button. The form will show the old value and the new value for the two cols based on the sql statement previously posted. If the data looks ok, I'll click the update button and it will change the data for that record updating to the new values. If I can't make sense of the data, then will skip that record and review later or ask supervisor whether to update or leave as is. If we start getting too much data back, then I'll look into seeing if I can apply some logic to speed up the process.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:37
Joined
May 7, 2009
Messages
19,228
you can make your Select query in Post#1 as Make Table Query or Append Query (to tmpTable).
Join tblLetters to this tmpTable and view.
 

Users who are viewing this thread

Top Bottom