I am currently working on the following piece of code for MS Access which
searches for a particular file name and then uses the Access Transfer Text
command to load to a table in my Access DB. I'm not a programmer so I'm just
winging this and what I'd really like to do is be able to move files that
are already processed to another directory so they can't be loaded again.
Any help that people can provide is greatly appreciated.
Private Sub Command0_Click()
Dim fs
Dim i As Integer
Dim sArchiveDir As String
sArchiveDir = "C:\scg\American Powernet\target\done"
Set fs = Application.FileSearch
With fs
.Lookin = "C:\temp\data\target"
.FileName = "INVOICE_*.CSV"
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
DoCmd.TransferText acImportDelim, "Bill Invoice", "Bill Invoice",
..FoundFiles(i), False, ""
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub