File Scripting Object in Access 2003

C

CaptainBly

I am trying to access the File Scripting object to use the fileexists
command to determine if a file exists. I have used this in previous
versions of Access without issue but when I am trying to run this in an
Access 2003 application I get the error: Object Doesn't Support this
Property or Method.

Here is a sample piece of code:

Dim fs

Set fs = CreateObject("Scripting.FileSystemObject")

file_name = "C:\comlog.txt"
If fs.filexists(file_name) Then
FileCopy file_name, "C:\Temp"
End If

Pretty straight forward I thought but I am missing something. This
code works in Access 2000 but not in 2003.

I added the Microsoft Scripting Runtime reference because I saw that
mentioned in other posts but that didn't help.

Any suggestions would be greatly appreciated.
 
D

Danny J. Lesandrini

Did you perform the latest Office Update? I've seen some issues with
the File Scripting Object that resulted after applying the latest patch.
Not sure what the solution is, but our network department spoke with
Microsoft Help Desk on the topic and it went away.

Can you test the code on a computer that doesn't have the patch?
That would tell you if it was a library or code issue.
 
T

TC

Who needs fso?

if dir$("c:\comlog.txt") = "" then
' doesn't exist.
else
' exists.
endif

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top