Link to home
Start Free TrialLog in
Avatar of ay3314
ay3314

asked on

Import Routine from Excel into Access

Does anyone have a generic import routine from Excel into Access? I am receiving a file in xls format weekly. What I would like to do is to name the file as file062201.xls (today), file062901.xls which would be the file I receive next week. I am going to save these files into one directory. I am looking for a generic import routine that would grab the data in excel and import into Access. This will replace any existing data in the table (as opposed to appending). Please help.
Avatar of Mikeh
Mikeh

1. you can link excel tables into access.  given you know the directory and file name then you can code this.

2. having linked the spreadsheet you could either run a query to replace the table data or do it in code.
Avatar of ay3314

ASKER

But that's what I am looking for - code!!
ASKER CERTIFIED SOLUTION
Avatar of frankytee
frankytee
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

sorry for the delay

here's some code

DoCmd.RunSQL ("delete * from accesstablename")

DoCmd.TransferSpreadsheet , acImport, accesstablename, "ExelPath",True(hasfieldnames)/False(doesnot),range"