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

XP - append query to pull data based only on a couple fields

Status
Not open for further replies.

mastro78

Programmer
Apr 10, 2007
70
US
I have an append query that is going to append data constantly. And the records it will append will be a mix of new and existing information. What I want is for it to append only data that is different from the records in the table it will be appending to. Like if fields 1-5 are the same but 6-8 are different, i want it to append only fields 6-8 to that record and not create a new record. How can I do this? Please help, thank you.
 
Have a look here:
thread701-1053292

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It's slightly more complicated than that since the data I'm retrieving is coming from a linked Excel file. I need to avoid appending incomplete data (1), avoid appending the same data (2), and update data based on the ID number (3)and if the new data is associated to the existing data in terms of ID (aka completing the rest of the record...filling in fields 6-8 if same data exists).
 
Sounds like you will run two queries:
1. Append - use an INSERT statement WHERE the fields don't match
2. Update - use an UPDATE statement WHERE the fields do match (basically use the same WHERE clase as #1 but put a NOT in front of it)

 
I'm not very versed in SQL, do you have a quick example? Or a place I can look to use as an example. Thanks for your help.
 
Google "Access Update SQL" and "Access Insert SQL", or just "Update" and "Insert" inside Access Help.


 
I would have to be well versed in SQl to figure this out, it's a lot more complicated and involved than what Googling can offer. Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top