Results 1 to 7 of 7
  1. #1
    ocm is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Location
    NE USA
    Posts
    40

    Append from excel

    Greetings,

    We receive monthly payments that a former employee used to input in the access db manually. In doing so, the Col_ID field (PK) is auto generated.
    Now, I would like to import the payments that is in excel to an existing access table. The column heading in excel (attached) spreadsheet exactly matches the field headings in access table.

    Col_ID in ms access is a primary key usually auto populated by the DB when someone enters a new payment. Currently, the Col_ID field in my excel is blank.


    1. Do I include the Col_ID field in my excel during the append process?
    2. How can I make sure that the Col_ID field in access table is populated?


    TIA



    Regards,
    Attached Files Attached Files

  2. #2
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    566
    I'd just create a linked table that points at the Excel file. Then you can just treat it like a normal table (well, sort of). Just create an append query and run it. Why not make a backup copy of the database and play with it? Seriously, TRY IT. The only thing an autonumber column does that's special is that it creates a mostly sequential set of numbers as it adds unique ID's to records.

    Instead of importing the contents of a blank column, why not just create a unique ID in the table you're importing into?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    As advised, append records. Don't include the blank Excel column. Access will still generate unique ID in the autonumber field.
    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.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Get rid of the Excel ID column, then just append as already mentioned.
    I would link to the Excel file from Access, then just keep overwriting the Excel workbook, so you do not add the records more than once, else you will need to check if they have already been added, if you are just adding rows to the worksheet?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    566
    Good point about not importing records already in the table. In that case, you could use the Find Unmatched Query wizard to return only the records that are in the new file but not in the database table. Then append only those. (Would make more sense if you try it with some dummy data, though, if you've never done it before - and to make sure you have it right).

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    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.

  7. #7
    Join Date
    Apr 2017
    Posts
    1,793
    As others here adviced, have an Excel table with payments to be imported linked to Access database. But use the linked table only for updating the payments table you create in Access database. I.e. you create an event (p.e. OnOpen, or OnClick for button, or whatever), which runs an append query to add the new payments from linked Excel table into Access Payments table. Optionally you can this script also to clear data from linked table after it is successfully imported to Access Payments table.

    On Excel side, my advice is you add into Excel workbook, with Excel Payments table linked to Access database, a button which will run a VBA script, which ask for client Excel file to be read in, and adds the payment info for this client into linked Excel table.

    The client sends the payment info in file of certain format > Some employee imports payment info from various payments files into linked Excel table > The Access VBA Procedure updates Access Payments table with info from Excel Payments table > The Access VBA procedure clears the info presently imported into Access Payments table from linked Excel Paymets table.

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

Similar Threads

  1. Append data to Excel worksheet from Access using VBA
    By jtan in forum Import/Export Data
    Replies: 2
    Last Post: 06-15-2017, 01:12 AM
  2. Replies: 22
    Last Post: 01-23-2014, 09:33 AM
  3. Import and Append Daily Excel Spreadsheets
    By JayRab in forum Access
    Replies: 13
    Last Post: 01-10-2014, 07:00 PM
  4. Importing excel file to append a table
    By vickan240sx in forum Access
    Replies: 1
    Last Post: 06-27-2012, 02:46 PM
  5. Excel Import/Append Data (weekly)
    By MartinL in forum Import/Export Data
    Replies: 1
    Last Post: 08-12-2010, 06:14 PM

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