UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Import Table From Html Page, Access 2010    
 
   
ftbnl
post Jul 22 2019, 12:41 PM
Post#1



Posts: 4
Joined: 12-February 18



I regularly download a webpage, containing a table, to a local folder.
I am able to import that table into my Access DB table through the Import Wizard.
When I want to use the stored import specification (either the “stored as…) as the one specified in the MYSYSIMEXSPEX table, to download a new HTML (with a different name) file things go wrong.

When I run the saved specification, run by the task window with responds with a message “the task was not performed”…..(.)
When I run DoCmd.RunSavedImportExport "Import_name" I get an runtime 3709 error (The search key was not found in any record

The MYSYSIMEXSPEX specification, run by DoCmd.TransferText acImportHTML, "Import_name", "tblImport", mypage, True, , results in error 3011 “… can’t find the object “different name” …()

Where am I going wrong???
Go to the top of the page
 
theDBguy
post Jul 22 2019, 12:58 PM
Post#2


Access Wiki and Forums Moderator
Posts: 76,396
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Welcome to UtterAccess!
welcome2UA.gif

If you're able to reimport the same file you originally created the spec for, then try renaming the new file using the same filename as the original one just to see if you still get an error.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
ftbnl
post Jul 22 2019, 04:44 PM
Post#3



Posts: 4
Joined: 12-February 18



thanks for your prompt reply, theDBguy.

I already have tried renaming the file. however somewere in the specifications the tablename (or simular data) is stored, so the spec keeps asking for the original name!
I can't find a the specifications script anywhere, so i can't change that part either.

I also renamed de specifaction to the name file, with the same (negative) result.

Go to the top of the page
 
theDBguy
post Jul 22 2019, 04:46 PM
Post#4


Access Wiki and Forums Moderator
Posts: 76,396
Joined: 19-June 07
From: SunnySandyEggo


Hi. Did you say the spec is looking for the original table? If so, yes, try renaming both the new file to match the original file and rename the current table from the previous import to allow the spec to create a new one. Just a thought...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
ftbnl
post Jul 22 2019, 05:31 PM
Post#5



Posts: 4
Joined: 12-February 18



thougt so myself, however:
when I create an import spec through the wizzard , it detects a table name e.g. theDBguy-UtterAccess#com.
When i look for that table name in de page source it cannot be found. (moreover: the htmlpages i download don't even have a <table> tag, so i can't use the "GetEelementby Tagname" trick)
The MYSYSIMEXSPEX has no tablename field.

I'm getting pretty desperate: i hate te prospect of creating 2000 + import specs over the next few weeks (months????)


Go to the top of the page
 
theDBguy
post Jul 22 2019, 06:27 PM
Post#6


Access Wiki and Forums Moderator
Posts: 76,396
Joined: 19-June 07
From: SunnySandyEggo


Hi. Can you post a sample html page with the table you’re trying to import? Thanks.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
ftbnl
post Jul 23 2019, 12:51 AM
Post#7



Posts: 4
Joined: 12-February 18



GOTIT!!!

I found a post from Clifford Bass on https://www.pcreview.co.UK :

With CurrentProject.ImportExportSpecifications("Export-tblBirthdays")
MsgBox .XML
.XML = Replace(.XML, "C:\", "D:\")
MsgBox .XML
End With

With that i was able to get the full import spec:

<?xml version="1.0" encoding="utf-8" ?>
<ImportExportSpecification Path = "c:\dowloads\mypage" xmlns="urn:www.microsoft.com/office/access/imexspec">
<ImportHTML FirstRowHasNames="true" CodePage="65001" AppendToTable="temp_dl" HTMLTable="webtable - site#com" >
<DateFormat DateOrder="DMY" DateDelimiter="-" TimeDelimiter=":" FourYearDates="true" DatesLeadingZeros="false" />
<NumberFormat DecimalSymbol="." />
<Columns PrimaryKey="{Auto}">
<Column Name="Col1" FieldName="FIELD1" Indexed="NO" SkipColumn="false" DataType="Memo" Width="246" />
<Column Name="Col2" FieldName="FIELD2" Indexed="NO" SkipColumn="false" DataType="Text" Width="5" />
<Column Name="Col3" FieldName="FIELD3r" Indexed="NO" SkipColumn="false" DataType="Memo" Width="92" />
<Column Name="Col4" FieldName="FIELD4" Indexed="NO" SkipColumn="false" DataType="Text" Width="27" />
<Column Name="Col5" FieldName="FIELD5" Indexed="NO" SkipColumn="true" DataType="Text" Width="102" />
<Column Name="Col6" FieldName="FIELD5" Indexed="NO" SkipColumn="true" DataType="Text" Width="53" />
</Columns>
</ImportHTML>

I create a new spec and named it "standard" : all futere pages will be saved as "standard.html" in the download folder.
On my ms Access form a made a button running the above Sub, to change the HTML table name, along with:
1 textbox : previous name
2 textbox : new name
then: .XML = Replace(.XML, "forms!myform.form previous name", "forms!myform.form new name")
DoCmd.RunSavedImportExport "standard"

all rows i was looking for are imported in my table!

The whole proces is now reduced to a few simple mouse clicks!

Thanks for your assistance!




Go to the top of the page
 
theDBguy
post Jul 23 2019, 07:29 AM
Post#8


Access Wiki and Forums Moderator
Posts: 76,396
Joined: 19-June 07
From: SunnySandyEggo


Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    19th October 2019 - 12:44 AM