473,320 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,320 software developers and data experts.

Transfertext with ADO Recordset created in Runtime

Hi

I'm trying to export an ADO Recordset generated at Runtime to a txt
file.

I know that you have two options for exporting Access information:
1) TransferText
2) Reading / Writing Text Files

Does Transfertext allow usage of Recordsets as source of information?
It works with tables and queries defined in Access DB but Can I use a
recordset generated in runtime?

The following code fails in the trasnfertext line...

Sub ExportTXTfile()
Dim rslt As ADODB.Recordset
Dim strSQl As String
strSQl = "SELECT * FROM [FBW-OrgLoad] WHERE [MAU]='3514'"
Set rslt = New ADODB.Recordset
Set rslt.ActiveConnection = CurrentProject.Connection
rslt.CursorType = adOpenStatic
rslt.Open strSQl
MsgBox rslt.RecordCount

**** Recordset is created in runtime and works.

DoCmd.TransferText acExportDelim, "", rslt, "C:\TEST3514.txt"
End Sub

Regards
LCK

Nov 13 '05 #1
2 4586
There is a third and, possibly, better option. It is the ADO recordset
save method.

With it

You could try

rslt.Save "C:\TEST3514.txt", adPersistADTG

instead of the TransferText Command.

This assumes your ADO references are OK.

adPersistXML will save as XML.

Note that you can recreate the recordset from the text file with the
Open method.

Nov 13 '05 #2
As one line:
CurrentProject.Connection.Execute("SELECT * FROM [FBW-OrgLoad] WHERE
[MAU]='3514'" ).Save "C:\TEST3514.txt", adPersistADTG

Nov 13 '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...
2
by: BigData | last post by:
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...
3
by: Jack Doman | last post by:
Does anyone know how I can use Access XP's TransferText method to import a tab delimited text file? It works fine for comma delimited files. *** Sent via Developersdex...
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...
4
by: carrionk | last post by:
Hi, I'm exporting data from MSAccess to a *.txt file using VBA. I have already set up specification to TAB delimited, no Commas for Text and saved it ( .. in File>Export, etc) The problem is...
0
by: Daron | last post by:
I am posting this as I have not been able to find a direct posting with a specific solution, just work arounds (usually the need to create custom import routines.) I found the solution! I am...
0
by: matchine | last post by:
This is a recommendation based on my research on an issue with the transfer text functionality. The comments below were from a tech I approched for help. "The transfer text process blocked...
3
by: Greg Strong | last post by:
Hello All, Why does Access (2003) create indexes on importing a CSV file to a table when using the TransferText Method in VB when the specification name does NOT have any indexes indicated? ...
1
by: MaryKJolly | last post by:
I want to create a Data Report in my project. I have created a Data Environment and connect my database to it. I want to select a recordset at runtime and display as the report. So in the 'Command1...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.