Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8346491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:01:59+00:00 2026-06-09T07:01:59+00:00

I have a table in my Access application which needs to be filled with

  • 0

I have a table in my Access application which needs to be filled with data in a bunch of Excel files. I tried this code:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, strTable, strExcelpath, True

But it overwrite the data in my access table each time instead of appending it and it gives absolutely no control over what is being sent.

I need to find a way to simply append the data from an Excel file to my Access table, both files have the same structure so I would like to know if there is a way to import it line by line without specifying the columns. However, for personal knowledge and fear of user uses, I would also like to know how to import it considering the lines and columns.

Thanks !

EDIT: Code with the select on the Excel file:

Dim cn As ADODB.Connection
Dim strQuery As String

Set cn = New ADODB.Connection
With cn
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "Data Source=" & Application.CurrentProject.Path & "\Excel\test.xls;" & _
                        "Extended Properties=Excel 8.0;"
    .Open
End With

strQuery = "INSERT INTO tblClients " & _
        "SELECT * FROM [Excel 8.0;HDR=YES;DATABASE =" & Application.CurrentProject.Path & "\Excel\test.xls].[tblImport$]"
DoCmd.RunSQL strQuery
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:02:03+00:00Added an answer on June 9, 2026 at 7:02 am

    You can also refer to an Excel sheet or range in a query:

    INSERT INTO Table1 ( ADate ) 
    SELECT SomeDate FROM [Excel 8.0;HDR=YES;DATABASE=Z:\Docs\Test.xls].[Sheet1$a1:a4]
    

    Or

    INSERT INTO Table1
    SELECT * FROM [Excel 8.0;HDR=YES;DATABASE=Z:\Docs\Test.xls].[Sheet1$]
    

    In a procedure:

    Sub RunThisQuery()
        strQuery = "INSERT INTO tblClients " & _
           "SELECT * FROM [Excel 8.0;HDR=YES;DATABASE=" _
           & Application.CurrentProject.Path & "\Excel\test.xls].[tblImport$]"
    
        CurrentDB.Execute strQuery, dbFailOnError
    End Sub
    

    Note that you had a space in your code after DATABASE. It must read DATABASE=, no space.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In an application we are developing, I have access to a database table which
I have Access table with fields, in which there is some data and path
I have an access table which has some cells as blank ( no data
I have a table in MS Access, which has the following data to be
I have an Access application in which I need to do a 'mass-update'. I
I have one application in which I need to delete table if exit in
I have a .NET application which allows users to access various databases by providing
I currently have a Web Application which is using it's own Permissions table which
In my web application I have a part which needs to continuously crawl the
We have a silverlight ASP .NET web application which needs to be deployed on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.