Deleting Text Files Rows from Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to delete rows from a text file prior to importing it into an
Access database using a module from within the database.

Can anyone suggest the best way to do this programatically?
 
Hi Marko,

Often it's best to link to the text file and then use an append query
to add the rows you want to our table. E.g. something like this air
code:

DoCmd.TransferText acLink, , "TempTable", "C:\Folder\MyFile.txt"
CurrentDB.Execute "qryAppend", dbFailOnError
DoCmd.DeleteObject acTable, "TempTable"

or (more elegantly IMHO) just use an append query that gets its data
direct from the text file, using syntax like this:

INSERT INTO MyTable SELECT * FROM
[Text;HDR=Yes;Database=C:\MyFolder\;].MyFile#txt
WHERE blah blah;"
 
Back
Top