Error 101

We have an application where an agent is used to read a text file that has been placed in the local database directory. For over 95% of users, this works fine and the agent can open and read from the file. The rest of the users get a “Unable to open file” error (error 101) when they try to run the agent. All user are on the same Lotus notes version.

There is no difference in the ACL access rights for each user and the file is definitely in the data directory. Any idea?? Thanks!!!

Subject: post your code

Subject: part of code

InputFileNum = Freefile() InputFileName = Inputbox$("Your input file should be in the following location: " + inputpath + ". Please enter only the filename of your input file including the .txt extension (for example: myinputfile.txt ) " ,“Input File Information”)

If InputFileName = "" Then

	Msgbox "You have cancelled the process - no addresses were generated" , 0+48,"Process Cancellation"

	Goto EndPoint

End If

	

txt_extension = Strleftback(InputFileName,".txt")

If txt_extension = "" Then

	txt_extension = Strleftback(InputFileName,".TXT")

End If

If txt_extension <> "" Then

	' do nothing - they've keyed .txt

Else

	InputFileName = InputFileName + ".txt"

End If



InputFileName = inputpath +  InputFileName



Open InputFileName For Input As InputFileNum

doc.InputFileUsed = InputFileName



' June 2005 - change filename string to "Mail Log" but leave the existing

MailUsageExceptionFileName = outputpath + doc.Unit(0) + " " + doc.HRFormName(0) + " " + workDate + " Mail Log Missing.txt"	

MailUsageExceptionFileNum = Freefile()

Open MailUsageExceptionFileName For Output As MailUsageExceptionFileNum <=====line with error



AllExceptionsFileName = outputpath + doc.Unit(0) + " " + doc.HRFormName(0) + " " + workDate + " All Exceptions.txt"	

AllExceptionsFileNum = Freefile()

Open AllExceptionsFileName For Output As AllExceptionsFileNum



AccessFileName = outputpath + doc.Unit(0) + " " + doc.HRFormName(0) + " " + workDate + " Not Accessed.txt"	

AccessFileNum = Freefile()

Open AccessFileName For Output As AccessFileNum



NotfoundFileName = outputpath + doc.Unit(0) + " " + doc.HRFormName(0) + " " + workDate + " Not Found.txt"		

NotfoundFileNum = Freefile()

Open NotfoundFileName For Output As NotfoundFileNum



GoodFileName = outputpath + doc.Unit(0) + " " + doc.HRFormName(0) + " " + workDate + " Good Names.txt"	

GoodFileNum = Freefile()

Open GoodFileName For Output As GoodFileNum

Subject: Make your code simpler

You could make your code much simpler like this:

Dim filearray As Variant

Dim inputfilename As String

filearray = ws.OpenFileDialog(False, “Select file to import”, “.txt",inputpath,".txt”)

if IsEmpty(filearray) Then

MsgBox “Cancelled.”

Exit Sub

End If

inputfilename = filearray(0)

This way you know you always have a valid filename, and don’t have to worry about that.

Next step is to run the whole code in the debugger and see if you can see anything that might, in certain cases, cause an error.

Add some error handling and display more info to the user there, so you can pinpoint the issue.