microsoft word microsoft access

  • Thread starter Thread starter bryansna
  • Start date Start date
Yes ... sort of.

I have an Access application that runs three times a day and searches
a folder for Word files (based on a template) that haven't been
processed yet. When it finds one it checkes a couple of fields to see
if it wants to get the data and then writes the data to an Oracle
database.

I imagine you could write some code in the template that would
acccomplish the same thing. Perhaps on a button click or something.
It involved quite a bit of code and was a PITA to set up. Are you
sure you want to go this route?

I'll give you what help I can,
RD
 
Just out of curiosity, why wouldn't you just use an Access form to enter the
data instead of a word template? If the data is going into Access anyway...
 
I am trying to convert a paper form to electronic and the database in use is
access. Can the form work while disconnected from the database? I need to
have it on a PDA type of machine and later sync back the documents/forms from
the day and then load them into the access database. Any guidance would be
appreciated.
 
Sorry, but I don't have a clue when it comes to PDAs. Are you running Word
on the PDA? If so, and if you can then transfer the word documents back to a
PC or laptop, you can read data from a Word document in VBA within Access.
I'm guessing that you would have named 'fields' within your template, and
there is a way to reference those fields. Here is an example of how you would
assign the value of two named Word fields to their corresponding fields in a
new record in a recordset:


Dim objWord As Word.Application
Dim rst As ADODB.Recordset

Set rst = New ADODB.Recordset
rst.Open "tblYourTableNameHere", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic

Set objWord = New Word.Application
objWord.Documents.Add "your fully-qualified file name goes here"

rst.addnew
With objWord.ActiveDocument.Bookmarks
rst!yourField1 = .Item("YourWordField1").Range.Text
rst!yourField2 = .Item("YourWordField2").Range.Text
end with

rst.update
rst.Close
Set rst = Nothing
objWord.Quit
Set objWord = Nothing

Of course, you'd have to have logic to figure out which word document to
open. This example assumes that you would be defining a new record for each
word document - I'm not sure exactly what you require. Hope this helps.
 
Yes, we will be running word from the PDA. This is a big help. Thanks for
the info. I really appreciate it.
 
Back
Top