|
|
TransferText - Multiple txt files simultaneouslyQuestion
AnswerStefano, ' Assuming that *.txt files to import are in the same
' directory as the .mdb with this code and that
' table name is "tblTest" we get this
' quick template solution:
Dim strTblName As String
Dim strFullDBPath As String
Dim strImpPath As String
Dim strImpFileNameExt As String
strTblName = "tblTest"
strFullDBPath = CodeDb().Name
strImpPath = Left(strFullDBPath, _
Len(strFullDBPath) - Len(Dir(strFullDBPath)))
strImpFileNameExt = Dir(strImpPath & "*.txt")
While (strImpFileNameExt <> "")
DoCmd.TransferText acImportDelim, , strTblName, _
strImpPath & strImpFileNameExt, True
Debug.Print strImpPath & strImpFileNameExt & " imported."
strImpFileNameExt = Dir
Wend
HTH, Copyright © 1999-2008 by Shamil Salakhetdinov. Original version is published here All rights reserved. |