Another "what kind of query is this" thread

vangogh228

Registered User.
Local time
Today, 11:48
Joined
Apr 19, 2002
Messages
302
I have a Customer table in an Accounts Receivable late-payments database that has very basic fields:

CustomerNumber, Name, BillToAddress1, BillToAddress2, City, State, Zip, Phone

As we get changes from new invoicing activity, I need the table to update the contact info. So, we get a spreadsheet each day with new invoicing activity, some of which will already have customers in our database. I need to capture any new addresses or other contact information to update my current records. We append the new info to the Invoices table, then need to grab the new addresses and update the Customer table.

I don't know why I don't know how to do this, as it seems so simple. Any help is greatly appreciated.
 
Seems like you have a three part situation.
Assuming that CustomerNumber is a unique identifier....

First you need an update query to set the address fields for each customer WHERE CustomerNumber in [Spreadsheet] has a match in CustomerTable.

Second, delete records in [Spreadsheet] where CustomerNumber in [Spreadsheet] has a match in CustomerTable.

Third, run an append query to add all the remaining records in [spreadsheet] to your customer table.

Needless to say, backup orignals of each before starting in case you get something wrong :)
 
Another thought, why not bypass EXCEL and update the addresses directly into the database? That's what they are for
 

Users who are viewing this thread

Back
Top Bottom