Append query not adding records

casablues

New Member
Joined
Jul 22, 2003
Messages
14
I am using the following Append query:

INSERT INTO EMPLOYEE_ROLES ( emp_id, role_code, local_role_code, primary_role_flg )
SELECT [User Roles TEST].emp_id, [User Roles TEST].GENERIC, [User Roles TEST].ROLE, 'Yes' AS Expr1
FROM [User Roles TEST];

The first two fields in EMPLOYEE_ROLES are primary keys. The User Roles TEST table contains records where the emp_id matches existing records in EMPLOYEE_ROLES, but the GENERIC data value does not - yet the record does not get added due to key violations. The fields in both tables have the same format.

If the incoming emp_id/GENERIC combination does not exist in EMPLOYEE_ROLES, why would the record not be added?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Here's a sample GENERIC value:

Z:DE10_MAT_MAS_DISPL_VIEW_FI

Does the colon cause problems? This value matches an existing value up through DISPL but the remainder of the value is unique.
 
Upvote 0
Solved it - The value being added is not included in a linked table with referential integrity active.

It's too bad Access doesn't provide more detail on the rejections. How about an error log?
 
Upvote 0

Forum statistics

Threads
1,221,544
Messages
6,160,432
Members
451,646
Latest member
mmix803

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top