|
-
Jul 24th, 2010, 01:35 AM
#6
Thread Starter
Lively Member
Re: Suggestions to resolve Runtime Error 75 path/file access denied
Hey Guys,
Thanks for replying.
Keith,
I figured since I was using the Close #xfilenumbr statement, the file number in use would clear each time and then I could reuse it. How do I reset the file number?
MartinLiss,
You're right. per your prompt, please see below...
Golgo1,
I'm not handling errors for this code yet. In the past, I was thinking of adding the On Error GoTo errHandler statement and then use the file Close #xfilenumbr statement but I was hoping to resolve the problem and then use error handling to catch any other errors that may occur which would at least keep the program running.
yes, the file open/lock scenario did cross my mind. So, I tried a static number ie: For Input As #1, close #1 etc. but the problem still happens.
as for as the 7 day situation. The error occurs on the 7th day from program startup. so it can occur on any day of the week. It also occurs at diffferent hours on the 7th day.
Pete,
I would have to test out and come back with the results. Which I'll definitely do but was hoping to try a possible fix first.
Code:
Private Sub Timer31_Timer()
Timer31.Enabled = False
Dim xfilenumbr As Integer
xfilenumbr = FreeFile
Dim abc As String
Dim xyz As String
Dim spath As String
spath = App.Path
Dim sttr As String
sttr = WeekdayName(Weekday(Now, vbUseSystemDayOfWeek), _
False, vbUseSystemDayOfWeek)
List2.Clear
Open spath & "\Logs\Bin\" & "POP3 Connection Log.txt" For Input As #xfilenumbr
Do While Not EOF(xfilenumbr)
Line Input #xfilenumbr, xyz
List2.AddItem xyz
Loop
Close #xfilenumbr
abc = spath & "\Logs\Bin\" & "POP3 Connection Log.txt"
Kill abc
Open spath & "\Logs\Bin\" & "POP3 Connection Log.txt" For Output As #xfilenumbr
Close #xfilenumbr
If List2.ListCount > 1000 Then
List2.Clear
Open spath & "\Logs\Bin\" & "POP3 Connection Log.txt" For Append As #xfilenumbr
Print #xfilenumbr, "-This POP3/Single PC mode computer successfully logged into the remote POP3 email account on" & " " & sttr & "," & " " & Now & "."
Print #xfilenumbr, " "
Close #xfilenumbr
Else
Open spath & "\Logs\Bin\" & "POP3 Connection Log.txt" For Append As #xfilenumbr
Print #xfilenumbr, "-This POP3/Single PC mode computer successfully logged into the remote POP3 email account on" & " " & sttr & "," & " " & Now & "."
Print #xfilenumbr, " "
For r = 0 To List2.ListCount - 1
Print #xfilenumbr, List2.List(r)
Next
Close #xfilenumbr
List2.Clear
End If
spath = vbNullString
sttr = vbNullString
abc = vbNullString
xyz = vbNullString
End Sub
Last edited by MartinLiss; Jul 24th, 2010 at 08:54 AM.
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
|