[AccessD] Kill Text

Gustav Brock Gustav at cactus.dk
Mon Mar 23 03:43:59 CDT 2009


Hi Max and Stuart

You can do better:

Public Function KillTxt() As Boolean
  Const cstrFile As String = "C:\Program Files\EMSReports\Imports\*.txt"
  Dim booSuccess As Boolean
  If Len(Dir(cstrFile, vbNormal)) > 0 Then
    Kill cstrFile
  End If
  If Len(Dir(cstrFile, vbNormal)) > 0 Then
    ' One or more files could not be deleted.
  Else
    booSuccess = True
  End If
  KillTxt = booSuccess
End Function


>>> stuart at lexacorp.com.pg 23-03-2009 09:28 >>>
You could wrap it in:
 On Error Resume Next
...
On Error Goto 0

--
Stuart

On 23 Mar 2009 at 21:21, Steve Schapel wrote:

> Max,
> 
> Yep, that's simple all right.  But will throw an error if no .txt files.
> 
> Regards
> Steve
> 
> 
> --------------------------------------------------
> From: "Max Wanadoo" <max.wanadoo at gmail.com>
> Sent: Monday, March 23, 2009 8:49 PM
> To: "'Access Developers discussion and problem solving'" 
> <accessd at databaseadvisors.com>
> Subject: Re: [AccessD] Kill Text
> 
> > Looks good to me, Stu.
> >
> > Even better (perhaps)
> >
> > Public Function KillTxt()
> >   Kill "C:\Program Files\EMSReports\Imports\*.txt"
> > End Function





More information about the AccessD mailing list