?
Solved

Error on TransferText

Posted on 2003-11-19
3
Medium Priority
?
661 Views
Last Modified: 2012-08-14
I am getting the following error when I try to use the TransferText method:
Method 'TransferText' of object 'DoCmd' failed.  

Does anyone know why I am getting this error??  My code is below....

    Dim strData As String
    Dim objACC As Access.Application

    Set objACC = New Access.Application
    strDB = gdb.Name
    gdb.Close
    objACC.OpenCurrentDatabase strDB

    If Len(Me.txtFileName) = 0 Then
        MsgBox "Text file spec not entered yet"
        Exit Sub
    ElseIf UCase(Right(Me.txtFileName, 4)) <> ".TXT" Then
        Me.txtFileName = Me.txtFileName & ".txt"
    End If
   
    Screen.MousePointer = vbHourglass
    If Me.optOutput(0).Value = True Then
        objACC.DoCmd.TransferText acExportDelim, CStr("Data Label Export"), CStr("LabelCIDSData"), CStr(Me.txtFileName.Text), True
    Else
        objACC.DoCmd.TransferText acExportDelim, "Formatted Label Spec", "LabelCIDSLabels", Me.txtFileName.Text, True
    End If
0
Comment
Question by:vb9666
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:ampapa
ID: 9782170
It could be some data in your file doesn't agree with your file spec. Have you tried manually importing your text file into Access?
0
 

Author Comment

by:vb9666
ID: 9787161
I am trying to export to the text file and use the TransferText method.  However, since it will not work, I do not have a text file that has been exported.  How do I look at the file spec??  I did not create it.

Thanks.
0
 
LVL 8

Accepted Solution

by:
ampapa earned 500 total points
ID: 9796251
Sorry, I thought you were importing into not out of Access I should have read more closely.

You can see the specs by going to View/Options and checking Hidden Objects and System Objects. They hide the filespecs for a reason so be careful but you might be able to get some clue as to what might be happening.

This is from the help file:
"SpecificationName  Optional Variant. A string expression that's the name of an import or export specification you've created and saved in the current database. For a fixed-width text file, you must either specify an argument or use a schema.ini file, which must be stored in the same folder as the imported, linked, or exported text file. To create a schema file, you can use the text import/export wizard to create the file. For delimited text files and Microsoft Word mail merge data files, you can leave this argument blank to select the default import/export specifications."

It appears that it should be using the default FileSpec? could be some other issue/installation problem?

Have you tried creating a filespec in order to do the import? Open access and Export your table to a Textfile, when the window opens click on "Advanced" that will allow you create and save a FileSpec. Then use that name when you try your export and see if that works. The filespec becomes a hidden Object and is also then associated with that DB.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question