vb9666
asked on
Error on TransferText
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
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
If Len(Me.txtFileName) = 0 Then
MsgBox "Text file spec not entered yet"
Exit Sub
ElseIf UCase(Right(Me.txtFileName
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),
Else
objACC.DoCmd.TransferText acExportDelim, "Formatted Label Spec", "LabelCIDSLabels", Me.txtFileName.Text, True
End If
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?
ASKER
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.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.