Table from HTML File to import into Access 2016 (1 Viewer)

Nous1970

New member
Local time
Today, 14:46
Joined
Feb 18, 2018
Messages
21
I have a recipe in HTM format and want to import the tables embedded in the file into existing tables.
There are 4 tables embedded, and they all need to go into 4 different tables.
Is there a way I can do it with some code instead of converting it online first?
I have attached the file for reference.
 

Attachments

  • Standard Mirepoix.zip
    1.2 KB · Views: 109
Last edited:

isladogs

MVP / VIP
Local time
Today, 13:46
Joined
Jan 14, 2017
Messages
18,209
You should be able to import html into Access direct.
However when I tried this with your htm file I got reserved error 5016

However you can open the htm file in a browser, then copy & paste the text into a memo (long text) field in Access as attached.
I expect this could be automated if you were going to do this regularly
 

Attachments

  • StandardMirepoix.accdb
    372 KB · Views: 100

Nous1970

New member
Local time
Today, 14:46
Joined
Feb 18, 2018
Messages
21
Thank you for the reply.

The solution doesn't work for me as there are 3 different tables the info needs to be imported to and not a long field.
1 table with ingredients where the amount, Units, Ingredients are specified.
1 table with the Yield of the recipe
1 table with the directions

when you look at the code of the HTM file it shows it is all there.
I just need to extract it if possible.

I now do it online and have to do the procedure 3 times and create 3 csv files
Then import them.

Not very time efficient, plus if you want to do more then one even worse.

Hope there is a solution for this.
 

Cronk

Registered User.
Local time
Today, 22:46
Joined
Jul 4, 2013
Messages
2,771
The file is not formatted correctly, at least by W3C standards (see https://validator.w3.org/check)

As the file is a text file, you could read the file into a string and then parse the string to extract the data in the format required.
 

Nous1970

New member
Local time
Today, 14:46
Joined
Feb 18, 2018
Messages
21
OK sounds good, but How would I be able to do the exact same thing?
I mean automate the fact that I have certain lines that need to go in different tables?
How would I be able to write a code to do this?
I can transform the text to the attached format. Just want to automate the process that if they load the form the data gets into the tables automatically.
Would access be able to recognize the data?
 

Attachments

  • Standard Mirepoix.txt
    1.2 KB · Views: 80

Cronk

Registered User.
Local time
Today, 22:46
Joined
Jul 4, 2013
Messages
2,771
Use file system object (FSO) to open your text file and read the contents into a string. Then use the instr function to find the data tag start/finish and extract the data in an iterative process.

I don't have time to be more specific but search FSO and make a start on your code. Then come back with what you have if necessary.
 

Users who are viewing this thread

Top Bottom