DoCmd.TransferText

  • Thread starter Thread starter Steven M. Britton
  • Start date Start date
S

Steven M. Britton

I am trying to create a

Private Sub btnExportCCs_Click()
DoCmd.TransferText acExportFixed - Export of my query.
End Sub

But I don't understand it at all??? Sorry... I have a
query that I can click on then go to file and Export with
spaces in it and is works fine, however I want to do this
automatically in VBA or something else I can click...

Can someone give me direction - What is the "For a fixed-
width text file, you must either specify an argument or
use a schema.ini file" - (Help File)
 
An old "KB" from Joe Fallon. . .

Auto Import txt file (Joe Fallon) - 12/21/01
You don't need the schema.ini thing.The Help file says to
use it OR the spec name. So just use the spec you created

DoCmd.TransferText acImportFixed, SpecName, tblTempImport,
txtFileName--

I'm trying to program an automatic way to allow User to
select a .txt file
& allow them to import it into the DB.

HTH - Bob
 
I am trying to export not import. This is what I have but
it doesn't work, I am told that I need an Object - Run
time error '424'

Private Sub btnExportCCs_Click()
DoCmd.TransferText acExportFixed, , qryCreate_Export,
Export.txt
End Sub
 
I'll find sample code & list here shortly.

If you Debug - Step, you will probably find the "424"
Error. Should be easy to find.

Bob
 
Here's some code. . .
DoCmd.TransferText acExportFixed, , "Your Query", _
"C:\Program Files\MyApp\Data Folder\MyData.txt", True

The "424" might be failing at "qryCreate_Export" -- If you
Debug, is that the line of code that fails?

Let us know - Bob
 
I am trying to export not import. This is what I have but
it doesn't work, I am told that I need an Object - Run
time error '424'

Private Sub btnExportCCs_Click()
DoCmd.TransferText acExportFixed, , qryCreate_Export, Export.txt
End Sub

You must enclose the names of your table/query and export filename in quotes:

DoCmd.TransferText acExportFixed, , "qryName", "c:\ExportFiles\Export.txt"
 
I added the quotes and now I get '2511' The action or
method requires a Specification Name arguement.

Any futher ideas?
 
I added the quotes and now I get '2511' The action or
method requires a Specification Name arguement.

Any futher ideas?


-----Original Message-----

You must enclose the names of your table/query and export filename in quotes:

DoCmd.TransferText
acExportFixed, , "qryName", "c:\ExportFiles\Export.txt"
 
If you Email me tomorrow (Mon the 10th), I'll explain to
you how to write the Spec. Will have to be after 10:00
East Coast time.

Bob
 
Back
Top