Copy Text files

B

Burt

Hi,

I'm trying to copy a text file from one folder to another
using VBA in MS Access.

You will be saving me a lot of time, if you could share
the information with me.

Thanks, in advance,

Burt
 
N

Niklas Östergren

Well one way of doing it, maby not the easyest and best way but still, is to
import the textfile into an existing table with all the fields neccesary by
using DoCmd.TransfereText method and then using the same method
DoCmd.TransfereText to export it into another folder.

Import textfile into your table using something like this:

DoCmd.TransferText acImportDelim, ,
"NameOfYourTableWhereDataShallBeImportedTo",
"FullPathToYourFolderWhereTextFileAreLocatedInclFileName", False

Then use this to export the test to your folder:

DoCmd.TransferText acExportDelim, , "NameOfYourTableWhereDataAreStored",
"FullPathToYourFolderInclFileName", False

This example abow is used for text seperated with semicolon. There are other
types of TransfereText methods. Use F1 to look for that. Open VBE-window
type DoCmd.TransfereText. Put cursor somewhere in "TransfereText" and hit
F1.

// Niklas
 
B

Burt

Thanks Niklas

I'm going to try that.

Burt
-----Original Message-----
Well one way of doing it, maby not the easyest and best way but still, is to
import the textfile into an existing table with all the fields neccesary by
using DoCmd.TransfereText method and then using the same method
DoCmd.TransfereText to export it into another folder.

Import textfile into your table using something like this:

DoCmd.TransferText acImportDelim, ,
"NameOfYourTableWhereDataShallBeImportedTo",
"FullPathToYourFolderWhereTextFileAreLocatedInclFileName", False

Then use this to export the test to your folder:

DoCmd.TransferText
acExportDelim, , "NameOfYourTableWhereDataAreStored",
 
J

John_M

Hi Burt

If you are using Access 2003 you can use :-

Filecopy [source], [destination]

If you include the full path in [source] and [destination] you can copy from
one folder to another.

Regards John_M
 
Top