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

Update Table A to Reflect Appended to Table B

Status
Not open for further replies.

CptTom

Programmer
Jul 16, 2001
117
US
I want to run a query on Table A, append those records that meet the criteria to table B and reflect that the records were appended. I can do this with 3 queries, update, append then another update. Anyone know of an easier way?

Table has about 18 Fields. What about writing it in a function????

Larry
 
I only see the need for two queries (maybe I missed something). I see an append query from A to B and then an update query on A using the same criteria as the append query. Yes, I think a function would be a great idea, especially if this is going to be something done frequently, maybe assigned to a button on a form. I would create your two queries, and the form with a button to do it. Then, in the events property of the button, click on the elipse (...) and bring up the code window. You will need to use the DoCmd.RunQuery methods. You should be able to get a really good example of that in the Help.

Now that I think of it, do you need to do this? Are table A and table B duplicate structures? Either way, it would seem you have some redundancy of data. If you post the structures here, we might be able to help you help yourself...

Hope that helps... Terry M. Hoey
 
How do I explain?

100% of my data comes in the form of flat txt.files, however, 98% data comes from identical systems and therefore the files are identical and easy to import. The remaining 2% do not. Therefore, I run a small VB program to eliminate the junk and create a txt file that is pure data. This is imported into a special file. Using the query, I make it look like the other table and then append it to the 98%. I want to hold the special file in case not all records are imported because the data does not match the criteria, e.g. report dates wrong, etc. AND to keep track of which systems have reported and which have not.

Larry
 
Ok, now I understand why. But did I help with the rest? Terry M. Hoey
 
I think so, I will test it over the weekend.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top