[AccessD] Linked tables have no rows and just field F1

Gustav Brock gustav at cactus.dk
Tue Jan 23 02:20:11 CST 2018


Hi Bill

That code will work, though vListSheets(i) not "is a particular worksheet" but will be the name given the linked table, and it will simply link the first worksheet. If empty, you'll see F1 only and, of course, no records.

To link a particular worksheet, specify this as the last parameter:

DoCmd.TransferSpreadsheet acLink, acSpreadsheetTypeExcel12Xml, TableName, FileName, True, "ParticularWorksheetName$"

/gustav

-----Oprindelig meddelelse-----
Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] På vegne af Bill Benson
Sendt: 23. januar 2018 03:52
Til: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Emne: [AccessD] Linked tables have no rows and just field F1

I am trying to link to excel worksheets with this command

      DoCmd.TransferSpreadsheet acLink, acSpreadsheetTypeExcel12Xml, vListSheets(i), DATA_FILE, True


vListSheets(i) is a particular worksheet. It has headers, and most of the sheets have data.
DATA_FILE is the Excel file's path.

What happens is each linked table has a field named F1 and the tables are empty. Probably a rookie mistake I am making... though I am not a rookie, so I am a little embarassed here. It has been 10 years or more since I used TransferSpreadsheet to link to an Excel file. 



More information about the AccessD mailing list