By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

Automatically Importing data from Excel into Access

P: n/a
Hi All!

I was wondering if you guys can help with this: I have created an
Access database which has a table with identical fields as a tab in an
Excel workbook. To update this table (tblClaims), I open it up and
delete all rows. Nex, I Import data into the table from Excel (i don't
use the Link Tables... function because it corrupted my Excel file
last time.) Is there anyway to automate this process? Ideally, I'd
like to open the Access file and a macro/program woud run right away -
this macro would essentially be doing what I described above.

I need to have the excel file and there's no way to eliminate it; but
I also need Access for it's powerful queries. Please help!

Thanks in advance!

May 17 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
To delete all records of a specific table, put this code in a SUB on a
form:

DoCmd.RunSQL "DELETE [TableName].* FROM [TableName];"

Then import the data into the table by adding this code:

DoCmd.TransferSpreadsheet acImport, , "TableName","C:\myDIR
\ExcelFile.xls", True, "A1:E500"

HTH - Max Vit

May 17 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.