Max Wanadoo
max.wanadoo at gmail.com
Sun Mar 22 18:00:48 CDT 2009
William, Good news. Without making any changes it ran, deleted the files and reported them. Bad news. That means I dont know why it has stopped running on your syste. Have you changed/removed a Reference? Try it on your other PC Max On 3/22/09, Max Wanadoo <max.wanadoo at gmail.com> wrote: > > > .I HATE THAT!!!!! > > Ho! Ho! Get used to it William. I might look 65 but I am really 21. The > difference being I started programming. > > I am struggling trying to get a web site up to host the access stuff I want > to develope. but in a short while, I will try your code in my system (with > the changes suggested by Jack - 'cos they make sense) I will come back and > it will be Good News or Bad New - I don't know which, but in the meantime go > and pour yourself a shot of good ol fashioned TEA! > > Max > > > > On 3/22/09, William Hindman <wdhindman at dejpolsystems.com> wrote: >> >> Max >> >> ...I copied the code out of a dev file, the working code has error code >> ...file names are the same >> >> ...its Sunday afternoon and as Stu pointed out, it works just fine now >> ...shakes head, wish I was still a drinking man. >> ...no freaking idea what is going on here ...sometimes it doesn't work >> ...now it does ...I HATE THAT!!!!! >> >> William >> >> -------------------------------------------------- >> From: "Max Wanadoo" <max.wanadoo at gmail.com> >> Sent: Sunday, March 22, 2009 6:21 PM >> >> To: "Access Developers discussion and problem solving" >> >> <accessd at databaseadvisors.com> >> >> Subject: Re: [AccessD] Kill Text >> >> >> > Some random thoughts: >> > 1. Is the directory the files in EXACTLY the same as the name in the >> code? >> > 2. put a breakpoint in and step through with F8. >> > 3. Put a msgbox or debug.print in to show the filecount before calling >> the >> > kill statement >> > 4. put some error handling in there. >> > >> > good luck >> > >> > Max >> > ps. I would just use the common old dir() and kill statement. I have >> never >> > know there was an application.filesearch - sommat new every day! >> > >> > >> > On 3/22/09, William Hindman <wdhindman at dejpolsystems.com> 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 >> >> >> >> > -- >> >> > AccessD mailing list >> > AccessD at databaseadvisors.com >> > http://databaseadvisors.com/mailman/listinfo/accessd >> > Website: http://www.databaseadvisors.com >> > >> >> >> -- >> >> AccessD mailing list >> AccessD at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/accessd >> Website: http://www.databaseadvisors.com >> > >