I am using this code to attempt an import of a fixed width .csv text file:
Private Sub cbImport_Click()
Dim strFileName As String
Dim strSQL As String
Dim strImportSpec As String
If IsNull(Me.txtFile) = True Then
MsgBox "You must find a file for import!", vbExclamation, "File Required"
Exit Sub
End If
strSQL = "DELETE GL_ImportTable.* FROM GL_ImportTable"
DoCmd.RunSQL strSQL
strFileName = Trim(Me.txtFile)
strImportSpec = "Import_GL"
DoCmd.TransferText acImportFixed, "Import_GL", "GL_ImportTable", strFileName, True
End Sub
I have used it with both a variable and the string shown for the Specification name and in each case I get a message that says:
"The text file specification "Import_GL" does not exist."
Obviously it does, and I have even copied the name right out of the specification list into the code.
Any help will be appreciated.
Thanks.