Import Sheet Error (1 Viewer)

zezo2021

Member
Local time
Today, 12:49
Joined
Mar 25, 2021
Messages
381
Hello friends

when trying to import a sheet from an excel file I face this problem

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TempDetails", txtFolderPath.Value & "\" & cboFileName.Value, False, cboSheets.Value & "$"

Sample of Sheet name Include dot
2.4_OTLDetails


This is not a valid name. Make sure it is a valid parameter or alias name, that it does not include invalid characters or punctuation, and that the name is not too long. (Error 3125) | Microsoft Docs


What should I do
 
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 10:49
Joined
Feb 19, 2013
Messages
16,553
the dot makes the name invalid, don't know if it will work but try surrounding with square brackets

"[" & cboSheets & "$]"

note .value is not required as that is the default property
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:49
Joined
Jan 23, 2006
Messages
15,364
You could try:
1- rename the file to remove the "."
2- post all related code
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:49
Joined
Feb 19, 2002
Messages
42,981
You wouldn't believe how upset Access gets if you try to import a spreadsheet with a column name that begins with space:) The problems this caused me had no impact on the state of Connecticut. If Excel could open the file, then there must be something wrong with Access and they weren't fixing it. Period!

To resolve the issue, I opened the spreadsheet using OLE, fixed the errant column name and saved the workbook. Then I used TransferSpreadsheet to import it:)
 

Users who are viewing this thread

Top Bottom