exporting data to text file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to export data from one table to a text file automatically; easy enough using TransferText. Is there anyway around specifying the complete path? I want the file to be created in the same folder as the .mdb file, and I want to be able to easily move my database without having to change any code.

thanks for any help

Alice
 
CurrentDb.Name
Will give you the complete path and name of the current
database. You can extract the path part and use that in
your TransferText.

Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
Will give you just the path part.
-----Original Message-----
I want to export data from one table to a text file
automatically; easy enough using TransferText. Is there
anyway around specifying the complete path? I want the
file to be created in the same folder as the .mdb file,
and I want to be able to easily move my database without
having to change any code.
 
Thanks for the suggestion. Actually after a lot of fiddling about, I discovered that only by specifiying a filename only (and not a full path in the DoCmd.TransferText )the file was written to the folder containing the database.

Alice
 
Back
Top