View Full Version : Multiple append queries


northy
08-31-2001, 03:33 AM
I am trying to append data to a table, however...i need to append data from multiple records into the same record in the other table.

IE. each project has an entry for each milestone in the source table but i want to take all this seperate data and write it to the same record in the table which i am appending to. The following code appends but each DoCmd appends to a new line...how can i change this to append to a single line?

DoCmd.RunSQL "INSERT INTO [Temp Project] ( [Project Plan Signed Off] ) SELECT [PRS Major Milestones].[Best Estimate] FROM [PRS Major Milestones] WHERE ((([PRS Major Milestones].[Project Ref])= GetID()) AND (([PRS Major Milestones].Milestone)= GetMilestone(1)));", -1

DoCmd.RunSQL "INSERT INTO [Temp Project] ( [Integration Test Start] ) SELECT [PRS Major Milestones].[Best Estimate] FROM [PRS Major Milestones] WHERE ((([PRS Major Milestones].[Project Ref])= GetID()) AND (([PRS Major Milestones].Milestone)= GetMilestone(2)));", -1

Thanks

jwindon
08-31-2001, 03:05 PM
That SQL seems like French to me at the moment. The only things that seems to come to mind is that you need to run an update query first. Delete those records and then run your append query.

Pat Hartman
09-02-2001, 04:02 PM
Append queries are used to add new rows to a table. Update queries are used to change the value of a particular column or columns in an existing row.

I'm not sure why you want to de-normalize your table structure. It will be much more difficult to work with this way. If you want to de-normalize it for reporting purposes, you may be able to do it easily with a cross tab query.