Export MS Word table data to Ms Access database (1 Viewer)

yamus

Member
Local time
Today, 09:15
Joined
Aug 12, 2020
Messages
81
Hello
I want to export data from Word table to an already existing Access database. Is there a way to do that?
I want to mention that the Word table is a sort of an equivalent to Access recordset.
I'll try to explain in details:
*My Access database is a sor like this
-Equipement table (idEquip, serialNumber, #idModelEquip, #idWarehouse)
-Model table (idModel, #idType,#idBrand, modelName)
-Type Table (idType, typeName)
-Brand Table (idBrand, brandName)
-Warehouse table(idWarehouse, warehouseName)
primary keys are mentionned first, foreign keys are preceeded with #
I have a query whose recordset is like this
(Warehouse name, Type of equip, brand of Equip, model of equip, serial number)
The world file contains tables that display data similar to the recordset mentionned above
How can I export data from word table into access table?

PS: I tried to clarify my request as much as possible
 

June7

AWF VIP
Local time
Today, 00:15
Joined
Mar 9, 2014
Messages
5,470
Advise not to use punctuation/special characters in naming convention, especially not as prefix.

You want VBA behind Word for exporting?
 

yamus

Member
Local time
Today, 09:15
Joined
Aug 12, 2020
Messages
81
Advise not to use punctuation/special characters in naming convention, especially not as prefix.

You want VBA behind Word for exporting?
Hi
1/ I just wanted to clarify using special characters
2/ Any method to help would be useful
Once again, i hope that i made my request clear for the community so they can help me
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 04:15
Joined
May 21, 2018
Messages
8,527
Does this need to be fully automated or can you paste the table into Excel, and just import it?
 

yamus

Member
Local time
Today, 09:15
Joined
Aug 12, 2020
Messages
81
Does this need to be fully automated or can you paste the table into Excel, and just import it?
Hi
It is not necessary to be automated. But, i would like to have an idea of the any existing practical method
Thanks in advance
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:15
Joined
Feb 28, 2001
Messages
27,179
I don't know of any direct method to directly export a Word table but MajP's suggestion - copy/paste to Excel first - would give you the option of importing the data from Excel to Access. It would also give you a shot at "massaging" the data before the actual import operation.

The only other way I know offhand would be to create a Word application object, find the table through the Tables collection in Word, and then use VBA to pick values out of the table's cells. It isn't that hard but might be more than slightly tedious. If you are not comfortable with VBA and the use of application objects, I would recommend MajP's method as being mechanically easier.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 04:15
Joined
May 21, 2018
Messages
8,527
The copy and paste to Excel and import into access could be done in the amount of time it will take me to write this post.
If you want to automate this as @The_Doc_Man Docman said you would need a bit of code. You would browse to the word document and open it via access code. You would create an Automation session and read each line of the table cell by cell. Then do an insert query. Not talking a huge amount of code. Maybe 50 lines or so, but not trivial if you have never done this before.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:15
Joined
Feb 19, 2002
Messages
43,266
The question comes down to - are you doing this ONCE or will you need to do it for multiple documents or multiple times for the same document. I'd use the suggested cut and paste method for a one-time event as the others suggested.
 

Users who are viewing this thread

Top Bottom