Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IMPORT Button/Macro to import a Excel file

Status
Not open for further replies.

kinselas

IS-IT--Management
Aug 4, 2002
60
AU
HI Please Help me.
I would like to create a button on a form, whereby I can import data from a Excel spreadsheet. What is the macro or code. I am using Access 2000.
Thanks
 
You will need to use the DoCmd.TransferSpreadsheet command. It works like:

Code:
DoCmd.TransferSpreadsheet [transfertype][, spreadsheettype], tablename, filename[, hasfieldnames][, range]

If you want more information on this and an example, then click on help and type in TransferSpreadsheet.

cew657
 
Cew657 thank you for your reponse, but I am having a problem with the syntax Please help. I am import from Excel 2000

DoCmd.TransferSpreadsheet [acImport], [acSpreadsheetTypeExcel9], [Outlets], [u:\Extract.xls], [True]

 
The brackets are what is causing the problem. The brackets were to show the components of the command. This is what your command would look like:

Code:
DoCmd.TransferSpreadsheet acImport,acSpreadsheetTypeExcel9, "Outlets", "u:\Extract.xls", True

HTH
cew657

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top