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!

Disappearing File

Status
Not open for further replies.

deesheeha

Programmer
Jul 28, 2006
38
IE
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:
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
 
If you want to import the file then ac[red]Import[/red]Delim may work better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top