Dear All, I have an excel file (.xls) with data in the first Sheet that is named "Customers". I also have an Access.mdb database that contains a table called " CustomerDetails". I would like to transfer the data from the excel sheet into the Access database using VB6 code. How can I do that? Thanks in advance,
3 Answers
this is quite simple to do, just place the below code in a module in Access and this will import it for you automatically. If you need the code to run you can place it in the form_open or something similar. You could even start it up with a batch file.
Function import()
basedir = "INSERT YOUR SPREADSHEET HERE"
DoCmd.TransferSpreadsheet _
acImport, _
acSpreadsheetTypeExcel9, _
"TABLE NAME HERE", _
basedir, _
False
End Function