msaccess VBA import file path - must it be physical path?
Posted on 2007-03-29
Hi all, here's a straighforward question.
I've got a form in Access 2000, with a command button, on a Windows machine.
Click the buttton and an Excel spreadsheet is imported.
My question: Do I HAVE to use a physical path? Can I not use a relative path?
When I use no path at all -only the name of the Excel file-, and simply place the Excel file in the same directory as the Access file, Access searches the MyDocuments folder for the Excel file.
Right now the code to import the spreadsheet is:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tblMyTable", "C:\data\MyFile.xls", True
Why doesn't this work:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tblMyTable", "MyFile.xls", True ?