Importing data from MS Word document to Access (1 Viewer)

sbrown106

Member
Local time
Today, 08:20
Joined
Feb 6, 2021
Messages
77
Hi

Sorry about this but I am new to VBA, I know a bit but stuck on how to do this - so if anybody could help me with this please.

I have hundreds of forms as ms word documents in the format below and would like to import them into Access.
So that the data in each form comes under one common field heading, so for example, there will be one top row in excel with
titles, Dob, Phone Number etc and all the data from the remaining forms falls under these headings.

I am thinking, it may be that I create a table of this in Excel first and then pull this into Access

Is it possible to do something like this? are there similar examples somewhere I can view?

Thanks for any help. Ive been doing it all manually at the moment copying and pasting so it would be great if
there was some way of speeding this up.


DoB: 01/01/1990
Phone Number: 07773338888
Email: Something@email.com
Date of Incident: 13/01/2021
Accident Type: text here
Accident Circumstances: Lots of text here.
Injury Type: text here
Expert Type: text here
GP:
Hospital:
somewhere General Hospital
Liability: text here
Translator Required?: text
 

Jon

Access World Site Owner
Staff member
Local time
Today, 08:20
Joined
Sep 28, 1999
Messages
7,303
Welcome to the forums! We are the most active Microsoft Access community on the internet by far, with posts going back over 20 years!

Here are just a couple of tips for you:

1. Feel free to ask any question you like, however basic you may feel it is, or even if it has been answered before. Our expert members thrive on helping you out!

2. If you prefer a dark theme to the forums, just go to the bottom left of this forum and click "Default style". You will then see a selection of themes to choose from. I like Shades of Blue. :)

3. If you like any of the answers you get, feel free to click the "Like" link on the bottom right hand corner of the post. If you hover over the Like link, you can even choose the type of smiley.

Above all, hang around here, have fun, learn stuff and join in.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 04:20
Joined
May 21, 2018
Messages
8,463
@sbrown106,
I have not tried it yet, but I think this can be fully automated without going to Excel first Assume all files are moved to a single folder.
1. Pick the folder with a pick folder dialog
2. Loop the files in the folder
3. Open the word file through vba automation
4. If these are Form fields then loop the formfields collection
5 Get the values each form field
6. Use an insert query or a Recordset add new to create a new record
7. close the word file
8. go to 2

Can you post a sample document with some bogus information? There will be a big difference between if these are real form fields, bookmark, or free text.
Normally the moderators move this out of "Introduce yourself" to an appropriate forum, but if not post a new thread in the VBA Modules forum. And put a hyperlink here stating the new thread is at location x.
 

Users who are viewing this thread

Top Bottom