[AccessD] Kill Text

Stuart McLachlan stuart at lexacorp.com.pg
Sun Mar 22 17:13:29 CDT 2009


Created the appropriate directory, created some text files and  pasted your code into A2K3.
It works fine for me.

You need to look somewhere else for your problem.  What value is .Execute returning?

--
Stuart



On 22 Mar 2009 at 17:44, William Hindman wrote:

> Group
> 
> ...the following function has been working fine in all versions of Access 
> from A97 through A2k2 but fails in A2k3
> ...I use it to delete any txt files in the directory before importing a new 
> one into it.
> ...regardless of the presence of .txt files it returns the 2nd msgbox and 
> does not delete the txt files in the directory
> ...I'm stumped ...anyone have any idea why its not working in A2k3? ...what 
> am I NOT seeing?
> -------------------------------------------------------------------------------
> Function KillTxt()
> 
> Dim fs As Variant
> Dim i As Integer
> Dim FileList As String
> 
>    ' Change to the appropriate folder
>    ChDir "C:\Program Files\EMSReports\Imports"
> 
>    Set fs = Application.FileSearch
>    With fs
>     .Lookin = "C:\Program Files\EMSReports\Imports"
>     .FileName = "*.txt"
>     If .Execute > 0 Then
> 
>         FileList = "*.txt"
>         Kill "C:\Program Files\EMSReports\Imports\" & FileList
> 
> 
>         MsgBox "There were " & .FoundFiles.Count & " *.txt file(s) found in 
> the C:\Program Files\EMSReports\Imports directory and deleted."
>         For i = 1 To .FoundFiles.Count
>             MsgBox .FoundFiles(i)
>         Next i
>     Else
>         MsgBox "There were no *.txt files found in the C:\Program 
> Files\EMSReports\Imports directory."
>     End If
>    End With
>    Set fs = Nothing
> End Function
> ------------------------------------------------------------------------------
> William
>  
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list