Transfer text from queries to text files.

M

Marco

Hi.

I'm trying to export some queries to text files.

One query for a diferent text file.

I'm doing it from forms VBA code.

I have this code: DoCmd.TransferText acExportDelim, FtpTxt,
"98_qry_ComandosFTP", ("C:\ftp.txt")

But is returning me this error: Text file specification field separator
matches decimal separator or text delimiter.

I import a existing file to get the SpecificationName wich is FtpTxt.


But it's working if I run it as a macro. I have this on the macro:

Transfer Type: Export Delimited
Specification Name: FtpTxt
Table Name: 98_qry_ComandosFTP
file Name: c:\ftp.txt
Has field names: No



I cannot put everything in the macro, because I have another exporting
queries to text files and File name cannot be fixed.

My full code is this:


Dim stFileName As String

Dim Numerador As String

DoCmd.SetWarnings False

Numerador = String(10 - Len([ID]), "0") & [ID]

stFileName = Numerador & ".txt"

FileName = stFileName ' this is to get the info to ftp commands

DoCmd.OpenQuery "95_qry_Actualiza_ComandosFTP_tbl32"

DoCmd.TransferText acExportDelim, FtpTxt, "98_qry_ComandosFTP",
("C:\ftp.txt")

DoCmd.TransferText acExportDelim, Export_ES,
"93_qry_Export_to_TXT_ES", ("C:\ES" & stFileName)

DoCmd.TransferText acExportDelim, Export_ES,
"97_qry_Export_to_TXT_FA", ("C:\FA" & stFileName)



Dim stAppName As String

stAppName = "C:\CallFTP.bat"
Call Shell(stAppName, 1)



this was working just fine.

Please help.

Regards,
Marco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top