I am having the same sort of problem. I am very new to Access and SQL.
I need to use the SQL view to do a simple INSERT (it's for a student
project):
INSERT INTO EMPLOYEE
VALUES ('Joseph','Norton','9194530394','70990238',1);
My question: - What is meant by "primary key violation"? This is the
first data I am attempting to insert into my database, so this error
message is confusing to me. Any ideas what I could be doing wrong?
Here's my create statement:
CREATE TABLE EMPLOYEE
(
[FNAME] VARCHAR(15) NOT NULL,
[LNAME] VARCHAR(15) NOT NULL,
[PHONE] VARCHAR(10) NOT NULL,
[DL] VARCHAR(12) NOT NULL,
[DNO] INT NOT NULL,
CONSTRAINT EMPPK PRIMARY KEY(DL),
CONSTRAINT EMPFK FOREIGN KEY(DNO) REFERENCES DEPT(DNUMBER)
);
Here is the error message I get:
[Microsoft Access]
Microsoft Access can't append all the records in the append query.
Microsoft Access set 0 field(s) to Null due to a type conversion
failure,
and it didn't add 1 record(s) to the table due to key violations, 0
record(s) due to lock violations, and 0 record(s) due to validation
rule
violations.
Do you want to run the action query anyway?
To ignore the error(s) and run the query, click Yes.
For an explanation of the causes of the violations, click Help
[Yes] [No] [Help]
Christian said:
Hi Ken,
I'm sorry as you can see the error message was very long winded and I
simply
didn't want to type it up, but you're right it's certainly needed:
[Microsoft Access]
Microsoft Access can't append all the records in the append query.
Microsoft Access set 0 field(s) to Null due to a type conversion
failure,
and it didn't add 11 record(s) to the table due to key violations, 0
record(s) due to lock violations, and 0 record(s) due to validation
rule
violations.
Do you want to run the action query anyway?
To ignore the error(s) and run the query, click Yes.
For an explanation of the causes of the violations, click Help
[Yes] [No] [Help]
Thanks for your help,
Christian Blackburn
"Ken Snell" (e-mail address removed) wrote in message
Nonfunctional as in...gives an error message? gives the wrong result?
--
Ken Snell
MS ACCESS MVP
"Christian Blackburn" (e-mail address removed)@Hotmail.com wrote
in
message Hi Gang,
I am trying to do something very simple in my mind anyways

. I
would
liketo copy the Name and Web fields from a Jobs table to an Employers
table.
Both tables have the same Name and Web constraints. The tables have
an
ID
in common Jobs.Company_ID = Employers.ID. And here's the non
functional
SQL:
INSERT INTO Jobs (Name, Web )
SELECT [Employers].[Name], [Employers].[Web]
FROM Employers, Jobs
WHERE [Jobs].[Company_ID]=[Employers].[ID];
Thanks for any and all help regarding this matter,
Christian Blackburn