By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,234 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,234 IT Pros & Developers. It's quick & easy.

Transfertext failure in referenced .mde

P: n/a
I am attempting to create a delimited text file by using
DoCmd.Transfertext as shown here.

DoCmd.TransferText acExportDelim, "ExportSpec", "QryFinalExport",
"Fileout.txt"

This works fine as long as I load the .mdb or .mde directly and run.

However, for various reasons, I need to reference this .mdb/.mde from
my main .mde and then run the transfertext in the referenced .mde.
When I try that, I get run time error 3625, "The text file
specification 'ExportSpec' does not exist. You cannot import, export,
or link using the specification."

I have determined that the transfertext is looking for the file
specification "ExportSpec" as well as "QryFinalExport" in the main
..mde instead of the referenced .mde. Because the transfertext MUST be
run in the referenced .mde, I cannot define the spec or the query or
link tables in the main .mde as a way around this problem.

I need a workaround for this or another way to export a tab delimited
text file.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
TransferText, TransferSpreadsheet, all the Transfer functions in Access
seem to have limitations and are not completely reliable, only reliable
under ideal conditions. You are better off using Open...For Output As
#1. This is in the Access help files under Open, Output. Here is a
sample how that works:

Sub writeToHardDrive()
Dim RS As RecordSet, i As Integer, str1 As String
Set RS = CurrentDB.OpenRecordset("tbl1")
Close #1 'make sure there are no references to any textfile
Open "C:\somedir\FileOut.txt" For Output As #1
str1 = ""
Do While Not RS.EOF
For i = 0 to RS.Fields.Count - 1
str1 = str1 & RS(i) & vbTab
Next
Print #1, str1
RS.MoveNext
str1 = ""
Loop
Close #1
End Sub

This will produce a tab delimited text file which can be imported into
Excel, for example. To take it one step further you could forgo vbTab
and just delimit with commas to a csv file (which is essentially an
Excel comma delimited file). Just replace vbTab with ", " and
FileOut.txt with FileOut.csv.
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2

P: n/a
Actually, if you run A2000/2002/2003, you could look at

http://trigeminal.com/utility.asp?ItemID=4

for a tool that lets you point anywhere for you spec.
--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Rich P" <rp*****@aol.com> wrote in message
news:3f*********************@news.frii.net...
TransferText, TransferSpreadsheet, all the Transfer functions in Access
seem to have limitations and are not completely reliable, only reliable
under ideal conditions. You are better off using Open...For Output As
#1. This is in the Access help files under Open, Output. Here is a
sample how that works:

Sub writeToHardDrive()
Dim RS As RecordSet, i As Integer, str1 As String
Set RS = CurrentDB.OpenRecordset("tbl1")
Close #1 'make sure there are no references to any textfile
Open "C:\somedir\FileOut.txt" For Output As #1
str1 = ""
Do While Not RS.EOF
For i = 0 to RS.Fields.Count - 1
str1 = str1 & RS(i) & vbTab
Next
Print #1, str1
RS.MoveNext
str1 = ""
Loop
Close #1
End Sub

This will produce a tab delimited text file which can be imported into
Excel, for example. To take it one step further you could forgo vbTab
and just delimit with commas to a csv file (which is essentially an
Excel comma delimited file). Just replace vbTab with ", " and
FileOut.txt with FileOut.csv.
Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.