Im having the weirdest problem!!!!!!
I have some code that allows the user to choose a file to import and then it imports the file using TransferText.... but when my code reaches the TransferText line, it ends, it doesnt import the file and the file disappears off the hard drive!!! Anyone got any idea whats causing it?? Is it something to do with the SpecificationName??
Here is the code:
and the offending line is...
I have some code that allows the user to choose a file to import and then it imports the file using TransferText.... but when my code reaches the TransferText line, it ends, it doesnt import the file and the file disappears off the hard drive!!! Anyone got any idea whats causing it?? Is it something to do with the SpecificationName??
Here is the code:
Code:
strFilter = ahtAddFilterItem(strFilter, "TXT Files (*.txt)", "*.txt")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, _
OpenFile:=False, _
DialogTitle:="Choose a TXT File...", _
Flags:=ahtOFN_HIDEREADONLY)
If Len(strInputFileName) < 0 Then
MsgBox "Please Choose a File!"
Else
Me.txtFileAddress = strInputFileName
End If
DoCmd.TransferText acExportDelim, , "tblImport", strInputFileName, True
DoCmd.SetWarnings (False)
DoCmd.RunSQL "INSERT INTO [Bitstream e-Bill Eircom details] ( [Customer Number], [Contract Name], Account, [Bill Number], [Bill Date], Area, [Circuit Number], Charge_Type, TransDate, Transdateto, Quanity, [Product Description], Amount, [Currency], [UG Order No], [ExcessUsage (Mins)], [TotalUsage(Mins)], Agent, SeqNo, Subscriber ) SELECT tblImport.CUSTOMER_NUMBER, tblImport.CONTRACT_NAME, tblImport.ACCOUNT, tblImport.BILL_NUMBER, tblImport.BILL_DATE, tblImport.AREA, tblImport.CIRCUIT_NUMBER, tblImport.CHARGETYPE, tblImport.TRANSDATE, tblImport.TRANSDATE_TO, tblImport.QUANTITY, tblImport.PRODUCT_DESCRIPTION, tblImport.AMOUNT, tblImport.CURRENCY, tblImport.ORDER_NUMBER, tblImport.EXCESS_USAGE, tblImport.TOTAL_USAGE, tblImport.AGENT, tblImport.SEQNO, tblImport.SUBSCRIBER FROM tblImport;"
DoCmd.SetWarnings (True)
DoCmd.RunSQL "DROP TABLE tblImport;"
MsgBox "Done!"
and the offending line is...
Code:
DoCmd.TransferText acExportDelim, , "tblImport", strInputFileName, True