Results 1 to 6 of 6
  1. #1
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138

    excel to database table in access

    Hi



    I need some help on how to do the following.

    I have a table in acces with 13 columns + Id column with auto number.
    I have a excel form that I fill in evry day, with info of items that have to left our company. it have only 7 column on it.

    How can I append the info form the excel sheet into table in access only using the 7 columns that is on the excel sheet.

    At the momnet I have to add all of them by hand, and somedays there are a lot of them, just want to make it easy for the user.
    The name of the excel form change every day as I have to save.

    Is there a sample on how to do it.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    You have 3 options.

    1. Refer to Excel file path in INSERT SELECT action query, example:
    INSERT INTO Table1(Company, Username, Description)
    SELECT Company, Username, Description
    FROM [Excel 8.0;HDR=YES;IMEX=1;Database=C:\Users\June\Info.xls x].[Sheet1$] AS T1;

    2. Set a link to Excel sheet with external data wizard and run INSERT SELECT action query

    3. Excel automation VBA review http://www.accessmvp.com/KDSnell/EXC...m#WriteFileRst
    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
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    1. Refer to Excel file path in INSERT SELECT action query, example:
    INSERT INTO Table1(Company, Username, Description)
    SELECT Company, Username, Description
    FROM [Excel 8.0;HDR=YES;IMEX=1;Database=C:\Users\June\Info.xls x].[Sheet1$] AS T1;
    Hi June7


    I want to try to use a query to this, Looks like the first point is htat I can use, but need some help, I an not so good in access, still learning, busy with a course about access.


    Is this correct what I think of

    1. in a query, can I ask it to open a window to select a excel file. (how to do this)

    2 make new table from the excel sheet, just with certain columns (how)

    3. Make a query and append just the columns from excel sheet i want to use in my normal table. (How)

  4. #4
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    June7

    I have got it to inport an excel file. did do it the long way, but how do I do it with query, to let me choose a file. and get it to make a table for it.

  5. #5
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    Testing qry
    Attached Thumbnails Attached Thumbnails insert.jpg   Beforeerror.jpg   error.jpg   Tables.jpg  

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    1. No, cannot be done within query - requires VBA automating Windows FileDialog and executing query statements.

    2. Possibly with a SELECT INTO action - here is a tutorial site for SQL https://www.w3schools.com/sql/sql_select_into.asp

    3. Haven't I already shown examples of this?

    Too much to teach you all this in forum venue. When you have code with specific issue, post a question so we can help you analyze.
    Do your research and tackle one step at a time.
    First learn about Windows FileDialog and how to use to navigate to and grab file path/name.
    Then learn about building and executing SQL statements in VBA.

    I don't know your data nor the code you ran so hard to advise specifics.
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 12-15-2017, 08:09 PM
  2. Replies: 7
    Last Post: 03-22-2015, 02:29 AM
  3. Replies: 5
    Last Post: 03-16-2015, 10:17 PM
  4. Replies: 2
    Last Post: 08-05-2012, 06:32 PM
  5. Replies: 1
    Last Post: 01-23-2012, 11:44 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