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.
 
T

TC

Who needs fso?

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

HTH,
TC
 
Top