D
Doug Stanley
I'm trying to automate the import of a directory of 200+
text files into Access 2000. I'm trying to adapt this bit
of code I found in the KB, but it keeps telling me an
expression I entered is the wrong data type for one of the
arguments.
I'm a VBA novice. Any help appreciated.
rivate Sub Command0_Click()
Dim InputDir, ImportFile As String, tblName As String
Dim InputMsg As String
InputMsg = "Type the pathname of the folder that
contains "
InputMsg = InputMsg & "the files you want to import."
InputDir = InputBox(InputMsg)
ImportFile = Dir(InputDir & "\*.txt")
Do While Len(ImportFile) > 0
' Use the import file name without its extension
as the table
' name.
tblName = Left(ImportFile, (InStr(1,
ImportFile, ".") - 1))
DoCmd.TransferText acImportDelim, "", InputDir, _
acTable, ImportFile, tblName
ImportFile = Dir
Loop
End Sub
text files into Access 2000. I'm trying to adapt this bit
of code I found in the KB, but it keeps telling me an
expression I entered is the wrong data type for one of the
arguments.
I'm a VBA novice. Any help appreciated.
rivate Sub Command0_Click()
Dim InputDir, ImportFile As String, tblName As String
Dim InputMsg As String
InputMsg = "Type the pathname of the folder that
contains "
InputMsg = InputMsg & "the files you want to import."
InputDir = InputBox(InputMsg)
ImportFile = Dir(InputDir & "\*.txt")
Do While Len(ImportFile) > 0
' Use the import file name without its extension
as the table
' name.
tblName = Left(ImportFile, (InStr(1,
ImportFile, ".") - 1))
DoCmd.TransferText acImportDelim, "", InputDir, _
acTable, ImportFile, tblName
ImportFile = Dir
Loop
End Sub