Renaming a Text File in Access 2002 using VBA

G

Guest

Hi,

I am converting an 97 Application to 2002. The 97 appln
has a code as,

OldName = "E:\Credinq\cma monthly\inquiry.txt":
Newname = "E:\Credinq\cma monthly\inquiry2.txt "
Name OldName As Newname


This is not working in 2002. The error "File Not Found"
comes up. I checked the value for Oldname using debugger
and it comes up correct and the file does exist.

Is it that 'name' method does not work in 2002? In that
case what is the equivalent in 2002?If name does work any
idea what the problem is?

Thanks.
 
G

Guest

Hi, Add Reference "Microsoft Scripting Runtime

Now write
Dim fso As New Scripting.FileSystemObjec
now try using fso.<various functions are available>.

Hope this help
 
J

Jim/Chris

Here are two methods for copying a file in Access 2000.
Maybe they will work in 2002

Private Sub Command10_Click()
FileCopy "sourcefile", "destinationfile"
End Sub

or if the file is in use try

Private Sub Command10_Click()
Dim fso As Object
Dim boverwrite As Boolean

Set fso = CreateObject("Scripting.fileSystemObject")
fso.copyfile "sourcefile", "sourcefile"

Set fso = Nothing

End Sub


Jim
 
V

Van T. Dinh

Name works fine in Access 2002.

The problem may be the space at the end of the NewName. Try without the
space.
 

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