Yea, i mean importing .txt files to the database. I got it to the code
below:
The only problem is i dont know what FileName to say ... under
DoCmd.TransferText acImportFixed, "Imperial Import Specification",
"1089_imperial_daily", "FileName: = ????? ", False, ""
Cause what it is doing right now is ... Access finds say 4 .txt file
in "C:\Temp\test" folder, and for i = 1 to 4, import this text file,
fixed, using this import specification, onto this table, in the file
that Access just found in the folder, ... so what's the language for
"the .txt file that Access is current on? (sorry, i know i'm not being
very clear). below is my code
Sub BatchImport()
With Application.FileSearch
..NewSearch
..LookIn = "C:\Temp\test"
..SearchSubFolders = False
..FileName = "*.txt"
If .Execute() 0 Then 'Files found
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
'upload Shipping report_daily
DoCmd.TransferText acImportFixed, "Imperial Import Specification",
"1089_imperial_daily", "???not sure what file name to put here",
False, ""
' append
DoCmd.OpenQuery "1089_Append", acViewNormal, acEdit
DoCmd.Close acQuery, "1089_Append"
DoCmd.OpenQuery "1089_imperial_clear", acViewNormal, acEdit
DoCmd.Close acQuery, "1089_imperial_clear"
Next i
Else
MsgBox "There were no files found."
End If
End With 'End Filesearch
End Sub
On May 26, 2:57 pm, Scott McDaniel <scott@NoSpam_Infotrakker.com>
wrote:
Quote:
On 26 May 2007 14:06:41 -0700, Alice <alicey...@gmail.comwrote:
>
Quote:
I'm trying to upload all .txt files from a specific folder using the
following code, but it didn't work. HELP
>
What do you mean by "upload"? Are you moving these to a web server? It appears that you're importing them to your
database, not uploading.
>
What do you mean by "didn't work"? Did the import fail? Did you get any error messages?
>
Scott McDaniel
scott@takemeout_infotrakker.comwww.infotrakker.com