Originally Posted by
John_G
You have Date + ID as a compound primary key (uses more than 1 field)
Here's what I would do to merge the data from your 4 tables into 1.
First, create your new table as you and I both described. Set the primary key to be ID + Date, but leave the table empty.
Now, create an Append query, with Table A as its source, and appending records to the new table you just created. Only include fields ID and Date from Table A in the new records. When you run the query, the new table will have the same number of records in it as Table A does.
Now modify the Append query to use Table B as its source, but still appending records with the same two fields to the new table. This time when you run the query, you will most likely get an error message that says some records cannot be appended due to key violations (or something like that). There is nothing wrong - it is doing exactly what you want it to do, i.e. prevent any duplicate (ID + Date) records in the new table. Select the option in the error message that allows you to execute the query anyway.
Do the same for tables C and D.
What you have now is you new table with all possible combinations of ID + Date from tables A, B, C and D.
Now, for step 2 you will create an Update Query. Add to the query the new table, and Table A. Join these two tables on ID and Date. Include in the field grid the field from the new table that matches the measurement field in Table A. For example, if Table A has fields ID, Date and Height, include Height from the new table in the field grid. In the "Update to" row for that field, put [Table A].[Height].
When you run the query, the Height values will be copied from Table A into the corresponding field in the new table. You may or may not get a message asking you to confirm the update, depending on your MS Access settings.
Now modify the Update query to use Table B, and updating the appropriate measurement field in the new table to [Table B].[Weight] (for example)
Do the same for Tables C and D and you're done.
I don't think you will get an error message like you described in the your initial post, but if you do, modify the offending table by deleting the Autonumber PK, and creating a new PK with ID + Date. That should fix it.
Good luck, and let us know how it goes.