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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link table from a spreadsheet in Excel to access 1

Status
Not open for further replies.
Dec 23, 2004
33
US
I use this code to import the table from Excel to access:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel97, "MyTable", "C:\MyFile.xls", True

How do I write code to link the MyTable to access instead?

Thanks.
 
Hi
DoCmd.TransferSpreadsheet acLink,8, "MyTable", "C:\Myfile.xls", True, ""
 
Thanks, SuicidEd.

I have two tables, MyTable1 and MyTable2, in the spreadsheet. The link works for both but the problem is the MyTable2 link is the same as MyTable1. On MyTabl2 link, it contains all the MyTable1 value.

DoCmd.TransferSpreadsheet acLink,8, "MyTable1", "C:\Myfile.xls", True, ""

DoCmd.TransferSpreadsheet acLink,8, "MyTable2", "C:\Myfile.xls", True, ""

What does the 8 stand or use for?

Thanks again.
 
How do I get the two tables from Excel linked to access? It seems like it works for the spreadsheet with only one table.

DoCmd.TransferSpreadsheet acLink,8, "MyTable1", "C:\Myfile.xls", True, ""

DoCmd.TransferSpreadsheet acLink,8, "MyTable2", "C:\Myfile.xls", True, ""



 
As a quick reply

The excel spreadsheets you are linking have the same name. Surely they must have different names?
 
In the Excel MyFile.xls spreadsheets, I have several tabs (MyTable1, MyTable2,..). I'd like to use the same names in access after they are linked.

Can I link multi tables within a spreadsheet in access?
 
Hi
DoCmd.TransferSpreadsheet acLink, 8, "My Table", "C:\Temp\1601000", True, "abc$"
DoCmd.TransferSpreadsheet acLink, 8, "My Table", "C:\Temp\1601000", True, "def$"

The last bit being the names of your worksheet followed by a dollar sign $
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top