Importing test files

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

Guest

I have text files given to me to be imported into a database table. This is
a new database application but I'm having some problems with the files. They
are .htm files but if I use the get external data for htm the error report
says the file contains no data. Most lines in the file contain 5 fields
which are delimited by a space. The gotcha is that the last field is a text
field which contains embedded blanks. There are also occasional lines that
are all text but they begin with an asterisk (*). There are many files to be
imported and then a new one will be generated each month so I need an
automated way to import the data, hopefully by a switchboard selection.
Appreciate any suggestions you might have.
 
Access's 'import from HTML' facility requires that the data be in a HTML
table (i.e. within a <TABLE...> ... </TABLE> structure, while importing from
a text file requires a regular text file with no HTML structure.

If your file uses HTML to lay out the data so it looks like a table but
isn't a <TABLE...> ... </TABLE>, Access won't be able to import it as it
stands. You'll need either to convert the HTML to a regular text file (there
are various utilities and scripts around for doing that) and import that, or
else write VBA code to parse the HTML, extract the data and append the
records to your tables.
 
Thanks for the insight. I am fairly new to Access and VB. The data file
looks like a flat file of text. Probably no value added in trying to convert
to an HTML table structure. Can you give me a VB code sample or place to
look to accomplish the import? Thanks.
 
If they're ordinary text files (delimited or fixed-width), change the
extension from .htm to .txt and then import using File|Get External
Data|Import or (in VBA) DoCmd.TransferText.
 
Back
Top