473,378 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Transfertext failure in referenced .mde

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
2 4670
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sue | last post by:
Using WindowsXP and AccessXP in 2000 Mode When I run the following code, I get error 3027 "Cannot Update. Database or object is read only." StrFolder = "C:\Comic Box\WebStore Interface...
6
by: Vladislav Moltchanov | last post by:
I have discovered a couple of years ago, that import with DoCMD.TransferText for CSV text file doesn’t work in Acc2000, while it works perfectly in ACC97. which has been discussed on this...
11
by: Shyguy | last post by:
I need to import a text file pretty much daily. I download the file and change the name to a standard name and then run the code to import the file into a table in my database. The problem is...
3
by: Typehigh | last post by:
I am a pretty saavy user, but I am having a real problem with the DoCmd.TransferText operation. I manually used the File>Get External Data> Import routine to set up an import specification. It...
3
by: Oliver Gabriel | last post by:
Hi, i want to export a table for later import, using vba. That´s my code: export: filename = "C:\HVOtabelle.txt"
3
by: Jim M | last post by:
I am trying to 'grab' a backend data path and filename from a text file (to be used when updated front ends are installed by users). I store this information by running: DoCmd.TransferText...
0
by: Sean Howard | last post by:
I have a strange problem linking tab delimited text files in Access 2000 (I am running Windows XP), please try this and let me know if I am going mad. Step 1. Create the tab-delimited text...
0
by: stuart | last post by:
I seem to have a problem with the use of the TransferText function. In 2 applications that I have, every few months, it seems to not export a few records from a table. In another application,...
8
by: =?Utf-8?B?TWFyaw==?= | last post by:
We've got a wierd failure happening on just one machine. One part of our product uses a 3rd party search implementation (dtSearch). DtSearch has a native core (dten600.dll), late-bound, and a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.