Append Query Anomoly

scooteman

Registered User.
Local time
Today, 07:05
Joined
Nov 30, 2009
Messages
57
I have a database to track employee training and I've set up an append query to archive records of employees who quit. I have employee info in one table and training records in a second table. The field [Employee_ID] is the primary key in the "Employee" Table and I have an [Employee_ID] field in the "Training Records" table. I set up a separate append query for each table with a corresponding Archive table. I set the criteria of the queries to archive Employee data where the [Date Terminated] field IS NOT NULL. The "Employee" append query works as it is suppose to. However, I can't get the "Training Records" Append query to correctly copy all fields. It will not copy the [Employee_ID] field. I did away with the date field which required both tables in the “Training Records” query and instead built a Combo box on a form to select an employee and used that for the criteria in my query but the query still did not append the [Employee_ID]. If, however, I take the form code out of the criteria and type in an employee ID directly and run the query, the append query will then copy the employee ID in to the archive table. I don’t understand why it does this. All the correct training records do copy over, its just the [Employee_ID] field that is left blank.

I need the employee ID to copy over just incase I ever need to restore records if someone were rehired.
 
I found the problem. When I created the archive tables I copied the original tables and pasted them as structure only and renamed them. For some reason the [Employee_ID] in my "Training Records Archive" field retained the the original relationship with my "Employees" table. So when I ran a delet query as part of the archive function it was deleting the info of that one field as part of the enforced referential integrety. I fixed the problem by deleting the [Empoyee_ID] field then recreated it and related it to the "Employees_Archive" table.

I'ts kind of strange that the delet query was only deleting that one field.
 

Users who are viewing this thread

Back
Top Bottom