I have code to import a .txt file into a table. I'm running into an issue where the filename begins with "Select " (note the space after Select). If there is no space after "Select" the code runs properly. This is clearly an issue with how the DoCmd.TransferText is processed and not the code.
Filename:
"Select Test.txt"
Error:
Syntax error (missing operator) in query expression 'Test#.txt'.
(3075)
I can check for "Select " in the filename and change it prior to import, but I'm wondering if there is a solution with double quotes or single quotes to get the function to read the inputs correctly. I've tried single quotes and a couple variations of double and single quotes without luck.
Anyone aware of a workaround other than checking the filename before import?
Code:
DoCmd.TransferText acImportFixed, msSpec, msImportTable, msFileName, False
Filename:
"Select Test.txt"
Error:
Syntax error (missing operator) in query expression 'Test#.txt'.
(3075)
I can check for "Select " in the filename and change it prior to import, but I'm wondering if there is a solution with double quotes or single quotes to get the function to read the inputs correctly. I've tried single quotes and a couple variations of double and single quotes without luck.
Anyone aware of a workaround other than checking the filename before import?