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

Updating Records in a Table Based on Records in Another Table?

Status
Not open for further replies.

firebirdta84

Technical User
Aug 23, 2007
56
0
0
US
I have an Access table named MasterCases that contains 5 fields - CaseNumber, CaseName, User, Event and EventDate. Every day, I receive another Access table called UpdatedCases from an outside source that contains these same five fields - but with updated information in the Event and EventDate fields. The UpdatedCases table does not contain all the records that are in MasterCases, only ones where the Event and EventDate have changed or ones with new CaseNumbers. My question is this - how can I make Access compare the CaseNumber and User fields of these tables and if they match, have the Event and EventDate from the UpdatedCases table overwrite the Event and EventDate fields for that CaseNumber in MasterCases? Would this just be an Update Query? It would also need to append any new records from UpdatedCases where the CaseNumber and User combo isn't found in the MasterCases table. Thanks in advance!

Joe
 
You need two queries, first the update query using an Inner Join on CaseNumber and User fields and then an append query joined on the same fields, but using a Left Join and appending only those records with Nulls for CaseNumber and User fields.
 
Have a look here:
thread701-1053292

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Okay, I got it to update the records where the two fields match...still trying to figure out how to append the records from UpdatedCases that aren't in the MasterCases.

Joe
 
Please post the sql you have for updating.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top