|
![]()
Controlling external files from within Access
Copying a FileThe VBA function for copying a file is FileCopy. Note that the file cannot be open for you to copy the file.Renaming a FileThe VBA function to rename a file is Name.Moving a FileThe VBA function to move a file is the same as that to rename it, i.e. Name.Deleting a FileThe VBA function for deleting a file is Kill. Note that this will completely bypass the Recycle Bin. If you wish to delete a file to the Recycle Bin, the you will need to use an API call, as described here.Checking for the existence of a FileAnother thing that you might wish to do when handling files is to check if it exists, for example before deleting it. The best way of doing this is to use the Len and Dir functions together:
This method is quicker than checking if Dir(strFile)="" as Access internally stores the length of a string as well as the value.
Copyright & Disclaimer | |||||||||||||
| Last modified at 06/06/2006 14:58:06 | ||||||||||||||