Results 1 to 7 of 7
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    Append query issue

    Hi

    I have two table which appear to be identical in format.

    Both have a key field called BaptismID

    I need to append from table 2 into table 1

    I set up an append query by creating the query using table 2 and then selecting the append button and selecting as a destination table 1

    Code:
    INSERT INTO tbl_Baptism ( ChurchID_fk, FicheNo, BirthDate, DateOfBaptism, YearOfBaptism, FullDateOfBaptism, ChildsName, Surname, Sex, Parents, Abode, Occupation, RefNo, PageNo, EntryNo, Minister, Notes )
    SELECT tbl_Baptism1.ChurchID_fk, tbl_Baptism1.FicheNo, tbl_Baptism1.BirthDate, tbl_Baptism1.DateOfBaptism, tbl_Baptism1.YearOfBaptism, tbl_Baptism1.FullDateOfBaptism, tbl_Baptism1.ChildsName, tbl_Baptism1.Surname, tbl_Baptism1.Sex, tbl_Baptism1.Parents, tbl_Baptism1.Abode, tbl_Baptism1.Occupation, tbl_Baptism1.RefNo, tbl_Baptism1.PageNo, tbl_Baptism1.EntryNo, tbl_Baptism1.Minister, tbl_Baptism1.Notes
    FROM tbl_Baptism1;
    When I run is I get a key violation error but the only key I can see is one the field BaptismID which I have not includes in the query

    Am I missing some thing

    thanks

    IanDatabase2.zip
    Last edited by Jen0dorf; 08-02-2016 at 05:35 AM. Reason: forgot attachment

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    You cannot add BaptismID if it is autoNum.
    you cannot add BaptismID if the BaptismID already exists in target table.

  3. #3
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    thanks for the response but as usual I am confuses

    BaptismId is an autonumber and unique and exists in both tables But I have not included that value/field in my query. Does access look at all fields whether included in the query or not?

    thanks

    Ian

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    No, if its not part of the query, then that's not it.
    if you have any other fields, INDEXED,NO DUPLICATES
    this will fail too.

  5. #5
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    I've been through both tables and only BaptismID is indexed and marked no duplicates.

    All the other fields are not indexed and allow duplicates

    Strange, not sure where to go now. Is there a way of comparing two tables proporties?

    thanks

    Ian

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    You could also check for fields that have Required = Yes in tbl_Baptism, but which are Null in tbl_Baptism1.

    I just looked at your attachment and that is not the case.

    I ran the query just as you had it in your attached database at it worked fine - no errors. I even ran it twice and it still worked.

    What is the exact text of the error you get?
    Last edited by John_G; 08-02-2016 at 11:30 AM. Reason: additional comments

  7. #7
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    just copied back the query I created to upload and it ran with no errors

    Weird!!!!

    Thanks for all the help

    Ian

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Append Query Issue
    By Voodeux2014 in forum Queries
    Replies: 2
    Last Post: 10-19-2015, 01:48 PM
  2. Access can't append all the records in the append query
    By fluffyvampirekitten in forum Access
    Replies: 2
    Last Post: 08-27-2015, 01:53 AM
  3. Replies: 4
    Last Post: 02-11-2014, 05:37 PM
  4. Replies: 1
    Last Post: 10-06-2011, 08:37 AM
  5. #Deleted issue with Delete/Append Query
    By WendyCha in forum Access
    Replies: 4
    Last Post: 08-05-2011, 08:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums