|
-
Jul 23rd, 2010, 03:54 AM
#1
Thread Starter
Lively Member
RESOLVED - Suggestions to resolve Runtime Error 75 path/file access denied
Hey guys,
Need your help in solving this problem.
My program executes a function once every 2 minutes. When this happens, my code further down below writes an entry into a text file. This occurs every 2 minutes indefinitely.
Everything works fine until day 7. On the 7th day this error appears "Runtime Error 75 path/file access denied". The error occurs on this line...
Open app.path & "\Logs\Bin\" & "Log these details here.txt" For Input As #xfilenumbr
'Here's my full code
Private Sub Timer31_Timer()
Timer31.Enabled = False
Dim xfilenumbr As Integer
xfilenumbr = FreeFile
dim abc as string
dim xyz as string
dim sttr as string
sttr = WeekdayName(Weekday(Now, vbUseSystemDayOfWeek), _
False, vbUseSystemDayOfWeek)
'opens the txt file and reads all the existing entries into the list2 box
List2.Clear
Open app.path & "\Logs\Bin\" & "Log these details here.txt" For Input As #xfilenumbr
Do While Not EOF(xfilenumbr)
Line Input #xfilenumbr, xyz
List2.AddItem xyz
Loop
Close #xfilenumbr
'deletes the txt file and all of its contents from the Bin folder
abc = app.path & "\Logs\Bin\" & "Log these details here.txt"
Kill abc
'Recreates a new empty Log these details here.txt file into the Bin folder
Open app.path & "\Logs\Bin\" & "Log these details here.txt" For Output As #xfilenumbr
Close #xfilenumbr
'If the entries in the list2 box are 1000 or more, the list2 box entries are cleared and the most recent entry is added to the file.
If List2.ListCount > 1000 Then
List2.Clear
Open app.path & "\Logs\Bin\" & "Log these details here.txt" For Append As #xfilenumbr
Print #xfilenumbr, "-This process completed successfully on" & " " & sttr & "," & " " & Now & "."
Print #xfilenumbr, " "
Close #xfilenumbr
Else
'If the entries in the list2 box are less than 1000, the most recent entry is added to the top of the file and the remaining list2 box entries are then appended below that entry.
Open app.path & "\Logs\Bin\" & "Log these details here.txt" For Append As #xfilenumbr
Print #xfilenumbr, "-This process completed successfully" & " " & sttr & "," & " " & Now & "."
Print #xfilenumbr, " "
For r = 0 To List2.ListCount - 1
Print #xfilenumbr, List2.List(r)
Next
Close #xfilenumbr
List2.Clear
End If
End Sub
I'm using an admin account for my testing and all works fine for 6 days straight. I cant figure out why the code throws the error on day 7. If anyone has any insight or another method to write/read the text file, Id really appreciate the help.
Thanks,
Patrick
Last edited by techsent; Oct 13th, 2010 at 08:24 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|