TransferText

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

Guest

THis is a kind-of repost. I thought I had this figured out, but today I am getting different results. Basically I want to export the contents of the table "TempCifPath" to a textfile in the same directory as the database. I do not want to have to specify the full path of the file, as it is very likely that the database will be moved about before I finish.
On Tuesday the following code wrote the file where I wanted it to be, in the folder with my database. However today the text file is appearing in what I suppose is the "default" windows directory on my pc (C:\Documents and Settings\adawson\My Documents). THis isn't the first time that a procedure worked one day, but not the next. So what's going on?

Private Sub Command67_Click()

DoCmd.TransferText acExportFixed, "TempCifPath Export Specification", _
"TempCifPath", "alice.txt"

End Sub

thanks

Alice
 
Use the path of the database in the filename:

DoCmd.TransferText acExportFixed, "TempCifPath Export Specification", _
CurrentProject.Path & "\TempCifPath", "alice.txt"
--

Ken Snell
<MS ACCESS MVP>

Alice Dawson said:
THis is a kind-of repost. I thought I had this figured out, but today I
am getting different results. Basically I want to export the contents of
the table "TempCifPath" to a textfile in the same directory as the database.
I do not want to have to specify the full path of the file, as it is very
likely that the database will be moved about before I finish.
On Tuesday the following code wrote the file where I wanted it to be, in
the folder with my database. However today the text file is appearing in
what I suppose is the "default" windows directory on my pc (C:\Documents and
Settings\adawson\My Documents). THis isn't the first time that a procedure
worked one day, but not the next. So what's going on?
 
Maybe I wasn't clear: I don't want to specify the absolute path as I want the database to work wherever it gets moved to on my computer.

Alice
 
CurrentProject.Path will return the path of the database whereever it's
located. Try it.

--

Ken Snell
<MS ACCESS MVP>

Alice Dawson said:
Maybe I wasn't clear: I don't want to specify the absolute path as I want
the database to work wherever it gets moved to on my computer.
 
Back
Top