Results 1 to 5 of 5
  1. #1
    Ray239 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    3

    Importing new data

    I'm currently using Access 2010. I'm trying to import new data into school database from excel, but I'm encountering some problems. I received thousands of students' mobile phone number with their student ID. This school database has a "student" table that includes name, student ID, address, enrollment information and home phone number.



    The student table already has student ID as primary key so I want to be able to import new data such as mobile phone number into existing table. I received an error message that said "the records you pasted contain primary key values that already exist in the destination table". I don't want to spend time finding students by their ID and inserting new data one by one.

    How do I insert new data into student table with existing primary key values? The excel I'm trying to import only has two columns, student ID and mobile phone number. I already set up new empty field called Mobile Phone Number in student database. It didn't work.

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    So some students and their ID's are already in the table and you need to update their phone number and other students are new records?

    This requires two SQL actions - INSERT and UPDATE.

    Set up a link to the Excel sheet then use it like a table (except can't edit data). You can use the link in queries and to build reports. You can use it as the source for SQL INSERT and UPDATE actions.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ray239 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    3
    Thank you for the reply. I think SQL UPDATE action is the best way to do it. What are the steps to do it? I tried to search for tutorials that show you how to update data based on primary key in Access, but no luck.

    EDIT: Is this an example of SQL update?

    UPDATE Students INNER JOIN NewSheet
    ON Students.StudentID=NewSheet.StudentID
    SET Students.PhoneNumber = NewSheet.[PhoneNumber];

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Yes it is.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ray239 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2015
    Posts
    3
    Thanks. I think it works.

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

Similar Threads

  1. Importing data and complex data structures
    By gilbertvb3 in forum Database Design
    Replies: 2
    Last Post: 04-28-2015, 03:21 PM
  2. Formstack & Importing Data via excel, best way to collect data?
    By Yogibear in forum Import/Export Data
    Replies: 2
    Last Post: 02-10-2014, 07:05 PM
  3. Importing .txt data
    By Redder Lurtz in forum Import/Export Data
    Replies: 4
    Last Post: 11-18-2010, 10:23 AM
  4. Importing data and data quality
    By fsmikwen in forum Import/Export Data
    Replies: 1
    Last Post: 02-01-2010, 03:15 PM
  5. importing data- find new data
    By cengineer in forum Import/Export Data
    Replies: 1
    Last Post: 12-10-2009, 08:56 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