Movefile method

S

Sam Darby

I want to automatically move a text file from the current
folder to an archive directory after importing the file
into Access. There is a MoveFile Method in VB Help, but
it evidently is not present in my version of Access
2002. When I type 'movefile' in the VB window and press
Enter, the M and F do not turn into capitals as i would
expect. when I try to compile the command line, the error
message says that the 'end of statement is expected'. as
far as i know, i am typing the method correctly:

"C:\test.doc".movefile "c:\temp\test.doc"

I get the same lack of results with Copy and DeleteFile
methods. I can I load these Methods into Access 2002?
thanks
 
D

Dirk Goldgar

Sam Darby said:
I want to automatically move a text file from the current
folder to an archive directory after importing the file
into Access. There is a MoveFile Method in VB Help, but
it evidently is not present in my version of Access
2002. When I type 'movefile' in the VB window and press
Enter, the M and F do not turn into capitals as i would
expect. when I try to compile the command line, the error
message says that the 'end of statement is expected'. as
far as i know, i am typing the method correctly:

"C:\test.doc".movefile "c:\temp\test.doc"

I get the same lack of results with Copy and DeleteFile
methods. I can I load these Methods into Access 2002?
thanks

MoveFile is a method of a FileSystemObject, so you'd have to create an
instance of such an object and then call the method. Your proposed
systax for calling the method is wrong, though; see the online help for
FileSystemObject and for MoveFile if you want to move your file this
way.

I say "if" because I wouldn't add the overhead for FileSystemObject for
something like this. The VBA Name statement can move a file, provided
the target folder exists. All you have write is

Name "c:\test.doc" As "c:\temp\test.doc"

to move the file "test.doc" from C:\ to C:\Temp.
 

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