Results 1 to 8 of 8
  1. #1
    almag is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    3

    Question Every time I try and copy/paste a large amount of data, I lose the first field

    Hello!



    I'm trying to add data from excel to a table in Access, but every time I copy and paste new records, my first field is replaced with what looks like a primary key; Access replaces the entire first column with numbers, the first record becoming 1, the second becoming 2, etc. Has anyone run into a similar problem?

    I'm new to Access, so please let me know if my question is unclear or if you need additional information. Sorry in advance if this is a common issue or if I posted this in the wrong sub.
    Any help would be greatly appreciated.

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Better to import the data than to use Copy/Paste.
    If you make sure that the field names in Excel match the field names in Access, and the Data Types correspond, it should work (though sometimes inconsistent/flaky data can cause import issues, in which case I usually like to export my Excel file to a text file, and import that).

  3. #3
    almag is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    3
    That's what I'm starting to try and use, but my one worry about that method is that I'll accidentally bring in duplicate records. Will the append query automatically look out for duplicates, or is there something else that I need to do?

  4. #4
    rbennion is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Jun 2017
    Posts
    17
    I have dealt with this before. I hacked it by inserting a blank column in Excel titled "ID", then copy and paste. As mentioned, best way is to import it, then you can specify whether or not to include the autonumber PK.

  5. #5
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If you have a primary key and/or set indexes on certain fields, you may be able to prevent duplicates that way.

    Otherwise, you can import to a temporary table and create a Query to find just the new records, and add them to your Main table using an Append Query.

  6. #6
    almag is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2017
    Posts
    3
    Each record does have an unique identifier, so I didn't include a primary key. Would that be enough for MS Access to recognize whether or not it's a duplicate record when appending?

  7. #7
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If you have set up the field in Access to not allow duplicates, it should automatically reject those records and not import them.

  8. #8
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Quote Originally Posted by JoeM View Post
    If you have set up the field in Access to not allow duplicates, it should automatically reject those records and not import them.
    But you will get the prompt about not being able to add all the records due to key violations. If the user can simply accept and choose not to be advised of each issue, then no problem, but this scares people. Otherwise, I think a macro or code so that warnings can be disabled will be needed. Code is the more elegant way of course, and probably wont' require warnings to be cycled if the Execute method of CurrentDb is used.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Normalization for large amount of data
    By kvollene in forum Database Design
    Replies: 8
    Last Post: 07-01-2016, 01:18 PM
  2. copy and paste part of a field
    By Jen0dorf in forum Access
    Replies: 2
    Last Post: 01-18-2016, 02:57 AM
  3. Adding large amount of Excel data into Access
    By gbmarlysis in forum Access
    Replies: 4
    Last Post: 06-16-2015, 02:34 PM
  4. Replies: 3
    Last Post: 03-19-2015, 02:11 PM
  5. Copy and Paste non-visable field
    By delap009 in forum Forms
    Replies: 2
    Last Post: 08-22-2013, 10:23 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