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!

Problem importing html into Access

Status
Not open for further replies.

BrooksR

Programmer
Feb 24, 2001
98
US
I'm an experienced Access/VBA developer and am having trouble with importing some html data files into Access.
I've tried:
1. Toolbar wizard, External Data, html Document - gives 2 errors, first says it can't file the html file, second says the file may be in the wrong format.
2. DoCmd.TransferText acImportHTML, ... - this gives an error 3011, file not found
3.
Set con = CreateObject("ADODB.Connection")
con.Open _
"Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=C:\...(folders)...\trades.html;" & _
"Extended Properties=""HTML Import;HDR=YES;IMEX=1"";"
None of these 3 work. All give errors.
The html file will open in a browser window (IE, Chrome) and looks fine.
There is something about this html file that Access doesn't like but I don't know what it is.
I can open Excel, click File, Open, set the filter to 'All Web Pages' and successfully open it there.
I've tried Googling for known problems with Access importing html but haven't found anything.
I wonder if any of the developers here have had similar issues. I'm attaching the problem html file.
Thanks!
 
 http://files.engineering.com/getfile.aspx?folder=03ace912-9313-4689-a2ec-ff87067c8f83&file=trades.html
The problem is that Access is falry limited on the HTML it will import as a table. Basically it needs to be able to recognise it as a single, simple table. Which your HTML is not. Get rid of the first table defined in the file, and the file then loads fine.
 
Hey strongm,

That was an excellent suggestion, thanks!
I removed the first table and the import wizard now works fine. It's great to have a workaround.
Attached is another file in the same format, also with 2 tables that has no problem importing with the wizard. I do have to tell the wizard that its the 2nd table I want, but that's ok. With the original file I attached, the wizard errors out before I have a chance to say its the 2nd file I want.
I guess it doesn't matter now, but I am curious why the first trades.html file causes a problem, but not the second trades.html ...
Regards,
Brooks
 
 http://files.engineering.com/getfile.aspx?folder=db4cebf4-cfa3-4357-a425-232f20a41bc2&file=trades.html
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top