M
makyland
Hi! Some users of my application are experiencing sudden Access shutdown
(message "Access has detected a problem and needs to close. Sorry for the
inconvenients") when the code tries to execute:
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(text_name) Then
Set f = fs.OpenTextFile(text_name, 1, 0)
Set f2 = fs.CreateTextFile(mydir & text_name2, True)
While f.atendofstream = False
<Some actions to copy part of one text into the other>
Wend
f2.close
f.close
Set f = Nothing
Set f2 = Nothing
Else
MsgBox ("Sorry, xml file not present in folder " & mydir)
End If
In principle fs was not declared (neither as Scripting.filesystemobject
(early binding) nor as object –late binding-). The code causes no problem in
most of the laptops but in some others it does. We have check the versions of
every referenced library and found no differences (Access 2003, SP2). What
can we do to avoid it? Will it make a change to declare fs as object? I have
read from Doug J Steele that use of filesystemobject should be avoided. Which
is the alternative?
Thank you in advance for your help!!!!
(message "Access has detected a problem and needs to close. Sorry for the
inconvenients") when the code tries to execute:
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(text_name) Then
Set f = fs.OpenTextFile(text_name, 1, 0)
Set f2 = fs.CreateTextFile(mydir & text_name2, True)
While f.atendofstream = False
<Some actions to copy part of one text into the other>
Wend
f2.close
f.close
Set f = Nothing
Set f2 = Nothing
Else
MsgBox ("Sorry, xml file not present in folder " & mydir)
End If
In principle fs was not declared (neither as Scripting.filesystemobject
(early binding) nor as object –late binding-). The code causes no problem in
most of the laptops but in some others it does. We have check the versions of
every referenced library and found no differences (Access 2003, SP2). What
can we do to avoid it? Will it make a change to declare fs as object? I have
read from Doug J Steele that use of filesystemobject should be avoided. Which
is the alternative?
Thank you in advance for your help!!!!