Importing Specific Fields from Word Doc. Table into Acess

  • Thread starter Thread starter ressane2002
  • Start date Start date
R

ressane2002

Hello All,

I'm working on a project that deal with a large number of identical
word documents. Eeach one has the same fields and same formate. The
only changes are the field information such as. Name, Address, Phone
Number, etc..

The location of each field is the same as all the other documents. i
would like to creat a macro that would allow me to import the fields
that I specify and store it in Access. I would like to have this
automated through small icon in the database.
Can any one help me please on this ?

Thank you,

(e-mail address removed)
 
The location of each field is the same as all the other documents. i
would like to creat a macro that would allow me to import the fields
that I specify and store it in Access. I would like to have this
automated through small icon in the database.

Yes, you can do it: although I'd probably do it in Word VBA rather than
Access. If you can write programmes in Access, you do it in Word too, as
it's all the same language but with different objects available.

It all depends on how your word documents work, but it would start
something like:

'
' if we are not in Access, we have to create the DAO objects
' ourselves. This is stil pretty easy: remember to set a
' reference in the VBA editor
'
set dbe = New DAO.DBEngine ' using early binding
set db = dbe.OpenDatabase("t:\data\mydatabase.mdb", false, false)
set rs = db.OpenRecordset("select * from myTable", dbopendynaset)

'
' point to the document
'
set doc = activeDocument

'
' then get the fields out of the document
' the best way of finding your text may or may not be as easy
' as this. You can probably get more details in the Word VBA
' programming group
'
rs.AddNew
rs!FirstField = doc.bookmarks("FieldOne").Range.Text
rs!SecondField = doc.Bookmarks("FieldTwo").Range.Text
rs.Update

'
' tidy up as usual
'
rs.Close
db.Close


The database part is easy, as you can see. The complications are likely
to be navigating the word document.

Hope that helps


Tim F
 
You probably aren't going to get the help you seek from these
newsgroups. The solution isn't one that comes cheaply and simply.

You have to know your way around both Access and Word. You need to
use a concept called Automation to get things to play together. That
means you have to design the complete application. The fact that you
ask that this be presented via a "small icon in the database" (command
button?) indicates that you aren't aware of the scope of what you
ask.

If you have a lot of time and energy, do some reading and play with
the bits and pieces. If you already know VBA you're well along the
path. It isn't rocket science, just lots of details.

If you're in a hurry, get professional help.

HTH
 
Back
Top