Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inability to transfer file with onerror in sub

Status
Not open for further replies.

hedgracer

Programmer
Mar 21, 2001
186
US
I have a problem that I have been struggling with for some time. Here is the code:

Private Sub cmdWireRoomFeeProcessCharges_Click()
strCnxn = set_connection()
Set cnxn = New ADODB.Connection
cnxn.Open strCnxn
strSQL_Execute = "dbo.WireRoomDownloadImportTableDelete"
cnxn.Execute strSQL_Execute, , adExecuteNoRecords

Dim dkg As Variant, str As String
dkg = Application.FileDialog(msoFileDialogFilePicker).Show
str = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)


DoCmd.TransferText acImportDelim, "WireRoomImportSpecification", "Wire_Room_Download_Import_Table", _
str


On Error GoTo mytrap
strCnxn = set_connection()
Set cnxn = New ADODB.Connection
cnxn.Open strCnxn
strSQL_Execute = "dbo.WireRoomDownloadUpdate"
cnxn.Execute strSQL_Execute, , adExecuteNoRecords
Exit Sub
mytrap:
Msgbox "Error in input file"
Resume Next
DoCmd.TransferText acExportFixed, "Night_Fills_ Export_Specification", "Wire_Room_Download_File_Query", "W:\Accounting\Access Globex Downloads [Night Desk Fees]\AWire_Room_Download_File_Query.txt"

The problem is that the final transfertext does not work! No file gets transferred out of the sub. When I comment out all of the code involved with the onerror the transfertext works. I have googled this thing to death with no answer. Any leads to the answer would be greatly appreciated. Thanks.
 
The Resume Next will make the code execute the next line after the error occured on. So the
Code:
DoCmd.TransferText acExportFixed, "Night_Fills_ Export_Specification", "Wire_Room_Download_File_Query", "W:\Accounting\Access Globex Downloads [Night Desk Fees]\AWire_Room_Download_File_Query.txt"
will never fire (I'm assuming that is the one you mean?)

If I've totally misunderstood you're problem just clarify it for me.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top