Append Query resulting in duplicate records

R

Rod

Any thoughts on why this append query duplicates every record:

INSERT INTO [tblCandidate-Test] ( CANDIDATE, [NUMBER], AREA_CODE, [NUMBER],
DIAL_NUMBER, [NUMBER], FOLLOWUP_NUMBER, DNC )
SELECT [tblRRD Output].Name, [tblRRD Output].PhoneNumber, Left([tblRRD
Output]![PhoneNumber],3) AS AREA_CODE, Right([tblRRD Output]![PhoneNumber],7)
AS [NUMBER], [tblRRD Output].PhoneNumber, [tblRRD Output].PhoneNumber,
[tblRRD Output].PhoneNumber, [tblRRD Output].DNC
FROM [tblRRD Output], [tblCandidate-Test]
WHERE ((([tblRRD Output].DNC)=False) AND (([tblRRD Output].[Caller 1])="RP"));

Thanks
 
J

Jeff L

Because in your FROM you are grabbing data from two tables, one being
the table you are appending to. Remove that table and try again. It
is not necessary.
 
R

Rod

I fixed the duplicate records problem but now receive an error when I run it:

"MicrosoftOffice Access ... didn't add ... 3232 records due to validation
rule violations..."

I do not have any validation rules set in the tables. Here is my updated
query:

INSERT INTO [tblCandidate-Test] ( CANDIDATE, [NUMBER], AREA_CODE, DNC )
SELECT [tblRRD Output].Name, [tblRRD Output].PhoneNumber, Left([tblRRD
Output]!PhoneNumber,3) AS AREA_CODE, [tblRRD Output].DNC
FROM [tblRRD Output]
WHERE ((([tblRRD Output].DNC)=False) AND (([tblRRD Output].[Caller 1])="RP"));

Thanks.
 
R

Rod

This worked, Jeff. Any thoughts on why I am getting the error I posted?

Jeff L said:
Because in your FROM you are grabbing data from two tables, one being
the table you are appending to. Remove that table and try again. It
is not necessary.
Any thoughts on why this append query duplicates every record:

INSERT INTO [tblCandidate-Test] ( CANDIDATE, [NUMBER], AREA_CODE, [NUMBER],
DIAL_NUMBER, [NUMBER], FOLLOWUP_NUMBER, DNC )
SELECT [tblRRD Output].Name, [tblRRD Output].PhoneNumber, Left([tblRRD
Output]![PhoneNumber],3) AS AREA_CODE, Right([tblRRD Output]![PhoneNumber],7)
AS [NUMBER], [tblRRD Output].PhoneNumber, [tblRRD Output].PhoneNumber,
[tblRRD Output].PhoneNumber, [tblRRD Output].DNC
FROM [tblRRD Output], [tblCandidate-Test]
WHERE ((([tblRRD Output].DNC)=False) AND (([tblRRD Output].[Caller 1])="RP"));

Thanks
 
J

Jeff L

Open your table in design view. Look at the settings for each field.
Do any of them have Yes in the Required setting or No in the Allow Zero
Length setting? I also noticed that you have [Number] several times in
your insert. You cannot perform an insert to the same field in an
insert query.

Hope that helps!


This worked, Jeff. Any thoughts on why I am getting the error I posted?

Jeff L said:
Because in your FROM you are grabbing data from two tables, one being
the table you are appending to. Remove that table and try again. It
is not necessary.
Any thoughts on why this append query duplicates every record:

INSERT INTO [tblCandidate-Test] ( CANDIDATE, [NUMBER], AREA_CODE, [NUMBER],
DIAL_NUMBER, [NUMBER], FOLLOWUP_NUMBER, DNC )
SELECT [tblRRD Output].Name, [tblRRD Output].PhoneNumber, Left([tblRRD
Output]![PhoneNumber],3) AS AREA_CODE, Right([tblRRD Output]![PhoneNumber],7)
AS [NUMBER], [tblRRD Output].PhoneNumber, [tblRRD Output].PhoneNumber,
[tblRRD Output].PhoneNumber, [tblRRD Output].DNC
FROM [tblRRD Output], [tblCandidate-Test]
WHERE ((([tblRRD Output].DNC)=False) AND (([tblRRD Output].[Caller 1])="RP"));

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top