View Full Version : Insert, Append, Update?


eyal8r
09-03-2007, 12:23 PM
Hey guys-
I have a 'Master Table' that holds all my imported records. After a few queries and whatnot- I need to break it down into specialized tables. For example- my Sales Associate info goes into one table (all their contact info, employee code, etc)- while the product info goes into another table.

As I import daily orders and whatnot- it also brings in the sales associates info. So, I want to have Access check the existing SalesEmployee Table for any existing records (by their employee code)- and if it doesn't exist, append it into the table. HOWEVER- if they are already showing in the SalesEmployee Table, I want it to check to see if their contact info is the same- if not, update it with the new info I am importing.

How do I go about doing this? Is this an update query all by itself? Or, do I need a more complex if/then statements and whatnot?
Thanks!

RuralGuy
09-03-2007, 04:21 PM
If you are going to assume the incoming data is the latest then you do not need to test to see if it is the same, just update.

eyal8r
09-03-2007, 07:02 PM
ok- so that I am clear...
If I do an update, it will update the exsiting records, AS WELL AS load in any new records that don't exist there yet?
Thanks bud!

Rabbie
09-04-2007, 12:42 AM
ok- so that I am clear...
If I do an update, it will update the exsiting records, AS WELL AS load in any new records that don't exist there yet?
Thanks bud!

You need an Append query to add new records to a table. An Update query will change fields in existing records. See Access help for more information on the different query types.

eyal8r
09-04-2007, 05:57 AM
huh. OK- so- if that's the case- do I need to make 2 different statements/passes at this? One to update the existing records, another to append them? How would I go about doing that?
Thanks again

eyal8r
09-05-2007, 06:38 AM
Any more hints on this one? I'm not sure how to go about checking to see if it's an existing record, or if it will be a new record...
Thanks for all the help you can give!