Import an Excel File into Existing Table not using the Import Wiza

G

Guest

Hi,

I have an Excel file which i wish to import into an existing table in my
database. I want to have a button on a form which when clicked prompts the
user to locate the file and then imports it without them having to run
through the import wizard - can I do this?

Any advice gratefully received..
Thanks,
 
A

Allan Murphy

Louise

Use the TransferSpreadsheet action

Create a button on your form

Using the Click event for the button add similar code to this

DoCmd.TransferSpreadsheet acImport, 8, "tbl_raw_data",
"d:\projects\data.xls", False, ""

tbl_raw_data is the name of my existing table, you will need to change this
to the name of your existing table
file data is the path and name of my spreadsheet file e.g.
"d:\projects\data.xls", change this to your file location and filename
False indicates that there are no headers.

Allan Murphy
Email: (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top