L
Linde via AccessMonster.com
Hi,
I used the procedure described below to automatically import text files,
using a defined import specification.
Public Function Import()
Dim strfile As String
ChDir ("c:\MyFiles")
strfile = Dir("*.txt")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "ImportSpecName", _
"AccessTableName", "c:\MyFiles\" & strfile, True
Kill "c:\MyFiles\" & strfile
strfile = Dir()
Loop
End Function
This all works great on one condition:
After opening the database, I first have to import one text file manually,
using the same import specification. If I don't do that, no data is imported -
no error messages appear.
After this first manual import, it all works well.
Does anyone have an idea how to solve this inefficiency?
Thanks in advance,
Linde
I used the procedure described below to automatically import text files,
using a defined import specification.
Public Function Import()
Dim strfile As String
ChDir ("c:\MyFiles")
strfile = Dir("*.txt")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "ImportSpecName", _
"AccessTableName", "c:\MyFiles\" & strfile, True
Kill "c:\MyFiles\" & strfile
strfile = Dir()
Loop
End Function
This all works great on one condition:
After opening the database, I first have to import one text file manually,
using the same import specification. If I don't do that, no data is imported -
no error messages appear.
After this first manual import, it all works well.
Does anyone have an idea how to solve this inefficiency?
Thanks in advance,
Linde