YasminaisReal
New member
- Local time
- Yesterday, 17:16
- Joined
- Feb 12, 2024
- Messages
- 3
Hello! I am fairly new to access and trying to append data from a new table that I created to an existing linked table. I'm working in the front end of a split database. The existing table has one primary key (Plankton_survey_ID) which is an autonumber. It also has two foreign keys (contact_ID and Monitoring_site_ID).
From what I understand, if the primary key is an autonumber then I do not include that field in an append query because it will autopopulate when the new data is added to the table.
When I try to run my append query, it says there are 240 key violations (and no other issues). I am trying to append 240 records, so this is every single record. This is the SQL for my query:
INSERT INTO tblMonitoring_Plankton_Tow ( Monitoring_site_ID, Collection_date, contact_ID, [Total_tow_distance_(meters)], Number_of_tows, [Total_tow_volume_(m^3)], towType, Comments )
SELECT DWRPTupload2023.Monitoring_site_ID, DWRPTupload2023.Collection_date, DWRPTupload2023.contact_ID, DWRPTupload2023.Total_tow_distance, DWRPTupload2023.Number_of_tows, DWRPTupload2023.[Total_tow_volume_(m^3)], DWRPTupload2023.towType, DWRPTupload2023.Comments
FROM DWRPTupload2023;
I have populated the contact_ID field and Monitoring_site_ID fields with the number corresponding to a record in each table. For example, if Bob Smith is a contact in the Contacts table and his ID is 123, I entered 123 into the contact_ID field in the table I created. I did the same in Monitoring_site_ID field.
How do I fix these key violations so that I can get this append query to run?
Thank you!
From what I understand, if the primary key is an autonumber then I do not include that field in an append query because it will autopopulate when the new data is added to the table.
When I try to run my append query, it says there are 240 key violations (and no other issues). I am trying to append 240 records, so this is every single record. This is the SQL for my query:
INSERT INTO tblMonitoring_Plankton_Tow ( Monitoring_site_ID, Collection_date, contact_ID, [Total_tow_distance_(meters)], Number_of_tows, [Total_tow_volume_(m^3)], towType, Comments )
SELECT DWRPTupload2023.Monitoring_site_ID, DWRPTupload2023.Collection_date, DWRPTupload2023.contact_ID, DWRPTupload2023.Total_tow_distance, DWRPTupload2023.Number_of_tows, DWRPTupload2023.[Total_tow_volume_(m^3)], DWRPTupload2023.towType, DWRPTupload2023.Comments
FROM DWRPTupload2023;
I have populated the contact_ID field and Monitoring_site_ID fields with the number corresponding to a record in each table. For example, if Bob Smith is a contact in the Contacts table and his ID is 123, I entered 123 into the contact_ID field in the table I created. I did the same in Monitoring_site_ID field.
How do I fix these key violations so that I can get this append query to run?
Thank you!