rename file in DOS through Access??

CATT1

Registered User.
Local time
Today, 23:55
Joined
Aug 20, 2001
Messages
11
Hi;

I would like to be able to enter the name of a file I need renamed (through filecopy) in an Access form, so that the filename (E102E557B.REC) gets renamed to E102E557B.TXT. There are quite a few files and renaming through the copy command one by one would be tedious.

Example:

FILECOPY “[FORMS]![F-DOWNLOAD]![FILENAME]”&.REC, “C:\WINPATH\[FORMS]![F-DOWNLOAD]![FILENAME]”&.TXT

Where the file name gets entered into a form and then we click to run the process that renames the file and then imports it.

Is this possible??

Than You.


Judy
 
Check the help files for the Name Statement. This example is using the value [file name without the extention] keyed into the text box named "txtFileName".

Code:
 Name “C:\WINPATH\" & txtFileName & ".rec" OldName “C:\WINPATH\" & txtFileName & ".txt"

Check the help files for the TransferText Method. This will transfer the text file into a table...

Code:
DoCmd.TransferText acImportDelim, , "TableNameHere", “C:\WINPATH\" & txtFileName & ".txt"
 
Thank You ghudson!!

It worked perfectly. I almost had the statement, but my quoutation marks were off.


Judy
 

Users who are viewing this thread

Back
Top Bottom