Update Queries Using Composite Keys - TechRepublic
Question
September 27, 2007 at 10:19 AM
crownandring

Update Queries Using Composite Keys

by crownandring . Updated 18 years, 9 months ago

I’m having an issue trying to get an update query to run properly. I have a table which includes five (5) specific fields to note:
1) Customer Number
2) Customer Part Number
3) Our Part Number
4) Cost
5) Price
There are other fields, including an AutoNumber ID field for the primary key, but these five are the ones I’m concerned with right now.

In the future, Cost and Price will occasionally need to be updated. The update data will come from an outside source that is either not compatible with Access or not directly available to tie to this Access database. The update data will be available in Excel, though, and will contain the above 5 fields.

My intention is that the udpate data can be imported into a new table in Access (named “PricingUpdates”), run the update query, then delete all the data in that table we just imported. The reason is that there are only about 1500 records in my database, and there are about 50,000+ records in the update data source.

In order to make a unique combination, I need the query to find where the records are identical using: Customer Number + Customer Part Number + Our Part Number = unique record.

Every time I have tried to design an update query to do this, I get either an error message saying that it couldn’t run because of “ambiguous outer joins” or it fails to update at all, and on a couple occasions it has actually apended one table or the other with blank rows of records.

My knowledge of SQL is nil. I have used VB very seldomly, and only when I couldn’t find any other way to get something done. In those instances, I typically sought out what I needed to have my database do by searching online and then copied and/or tweaked existing code snippets. Most of the time I was able to do this without asking for any assistance whatsoever, but this time around (and it’s been a few years since I’ve had to do ANYthing with Access) I am completely stumped.

Hopefully I’m just an idiot for forgetting something simple, but I’d be greatly appreciative for any assistance!

This discussion is locked

All Comments