PDA

View Full Version : Importing an .RTF File into Access 2010 using VBA



krismcmillan
12-15-2015, 12:23 PM
Hello

Is there a way of importing an .RTF file into Access using VBA, a bit like the using Text columns feature in Excel?

Below is an example of the RTF file, that I'm trying to import.

Owner Location Type Product Code Product Description/Desc 2 Pack Size Rotation No. H A Cases/ Units

E45 AA/09A/1 Pick 00271296 PU VALUE BINA RED ASSTD 0/ 0
E45 AA/09A/1 Pick 00319997 2B FASHIONJOGLEG BLU/GRY ASSTD 0/ 0
E45 AA/09A/1 Pick 00371296 PU VALUE BINA RED ASSTD 0/ 0

jonh
12-15-2015, 03:31 PM
If you can get the wizard to import the file, there is an option to save the schema (specification).

then you can specify that schema for other imports.

docmd.TransferText acExportDelim ,SpecificationName ...

hth

krismcmillan
12-16-2015, 11:25 AM
Hi Jonh

That worked fine. Is there a way of deleting any unwanted rows?

jonh
12-16-2015, 12:27 PM
use a query

currentdb.execute "delete * from yourtable where somefield = 'whatever'"