G
Guest
The code below successfully calls two functions that create a schema.ini file
based on user selected file input and an existing table; but when I try to
import the selected file into a new temporary table using the
DoCmd.TransferText command line, I receive the following error... "The text
file specification 'schema.ini' does not exist. You can not import, export,
or link using the specification." Any ideas why?
Function fncImportTextFile(strImportTbl As String, blnRow1FldNames As Boolean)
Dim strFilepath As String, strPath As String, strFile As String
Dim strSpec As String, strTmpTbl As String, strMsg As String
On Error GoTo Err_Handler
strFilepath = GetOpenFile("Please select an INPUT file...", 5)
strPath = Left(strFilepath, Len(strFilepath) - InStr(1,
StrReverse(strFilepath), "\") + 1)
strFile = Right(strFilepath, InStr(1, StrReverse(strFilepath), "\") - 1)
CreateSchemaFile blnRow1FldNames, strPath, strFile, strImportTbl
strSpec = "schema.ini"
strTmpTbl = "_import_" & strImportTbl
DoCmd.TransferText acImportDelim, strSpec, strTmpTbl, strFilepath,
blnRow1FldNames
Exit_Handler:
Exit Function
Err_Handler:
Msg = "Error #: " & Format$(Err.Number) & vbCrLf & Err.Description
MsgBox Msg, vbOKOnly, "Error..."
Resume Exit_Handler
End Function
based on user selected file input and an existing table; but when I try to
import the selected file into a new temporary table using the
DoCmd.TransferText command line, I receive the following error... "The text
file specification 'schema.ini' does not exist. You can not import, export,
or link using the specification." Any ideas why?
Function fncImportTextFile(strImportTbl As String, blnRow1FldNames As Boolean)
Dim strFilepath As String, strPath As String, strFile As String
Dim strSpec As String, strTmpTbl As String, strMsg As String
On Error GoTo Err_Handler
strFilepath = GetOpenFile("Please select an INPUT file...", 5)
strPath = Left(strFilepath, Len(strFilepath) - InStr(1,
StrReverse(strFilepath), "\") + 1)
strFile = Right(strFilepath, InStr(1, StrReverse(strFilepath), "\") - 1)
CreateSchemaFile blnRow1FldNames, strPath, strFile, strImportTbl
strSpec = "schema.ini"
strTmpTbl = "_import_" & strImportTbl
DoCmd.TransferText acImportDelim, strSpec, strTmpTbl, strFilepath,
blnRow1FldNames
Exit_Handler:
Exit Function
Err_Handler:
Msg = "Error #: " & Format$(Err.Number) & vbCrLf & Err.Description
MsgBox Msg, vbOKOnly, "Error..."
Resume Exit_Handler
End Function