AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Append Query - Duplicate Values!!!

Using MS Access - Append Query - Duplicate Values!!!


Expert: Scottgem - 12/8/2006

Question
Would you please elaborate.  I searched on the "help" part of access, but it didn't give much insight to me.  I assume this should be done in the actual append query. Also, The tbls for Question and Employee both are set to Yes (NO Duplicates) for their primary keys.  

Here is the code I used (append qry) if that helps:

INSERT INTO tblAnswers ( EmployeeAutoID, QuestionNumber )
SELECT tblEmployee.EmployeeAutoID, tblQuestions.QuestionNumber
FROM tblEmployee, tblQuestions;

Thanks for the assistance.
-------------------------------------------
The text above is a follow-up to ...

-----Question-----
Hi.  I am using an append query to allow for pre-population of questions and answers for employees.  This works great when I enter the client, then run the query and then enter the data.  However, if I do this step, then go back and enter a new client information and run the query again…  I end up with 2x the data for the original employee.  It has data with 1 of the questions and answers with the originally filled in amount, but then it has a second question and answer that is blank.  I need to eliminate this from the table.  Is there a way to set up an append query to do what I’ve been doing, but not append employees that have already had data entered?  Or is their a way to make it eliminate any duplicate questions per employee by removing the answers with 0 entry ( or if both have 0, then to make it simply show 1)?  I know this isn’t the best worded question, but I couldn’t think of how to word what I am trying to solve.
-----Answer-----
Set a unique index on the combination of QuestionID and EmployeeID. You will first have to remove the dups and you can de that with a Delete query filtering for 0 Answers.

HTH
Scott<>

Answer
Search help on Multi-field index. You need to set a unique indox on a COMBINATION of fields. This is different from the PKs.

The Append query is fine. Though its creating records for all employees. You might want to change so it creates the records just for a specified employee.

HTH
Scott<>

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.