Solved

Error on TransferText

Posted on 2003-11-19
3
658 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 125 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

695 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