Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Apr 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Read from Word doc into Access database (97)

    Hi I was wondering what options exist for creating a Word doc that can have certain fields that can be read into an Access database. If I created a word doc from a mail merge is there a way if say the name field was edited in the doc that it could be read back into the name field of the database? So that the next mail merge would print the updated name in the new doc. Is this possible?
    Thanks for your help

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Read from Word doc into Access database (97)

    I can't say whether or not there is a method in VBA and maybe one of the experts who is more familiar with Access & VBA may have a solution. However,. so far as I know, there is no way to edit an Access database through making changes in a Word field. In Word, you have the ability to update a source document by making changes in the target document when using the Includetext field (by making the change in the target field & pressing Ctrl+Shift+F7). The closest I can think of is pressing the "Edit Data Source" button on the Mail Merge toolbar. But this opens up Access with the table or query selected.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Read from Word doc into Access database (97)

    In a merged document, there is no link any more to the data source.
    In the merge document (the one with the field codes), it might be possible to have a macro that reads the Result property of the MERGEFIELD fields (when you view field results), and executes a query to update the record source. But I think it would be a very tricky process, and anyway, it wouldn't be automatic ( I don't know of a way to run the macro automatically whenever you edit a field result). Editing the merge document this way is dangerous: if you aren't careful, you might end up replacing a field code with static text instead of editing the field result.
    For that reason, I recommend not even trying this approach.

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Read from Word doc into Access database (97)

    If you were using Word 2000 or later, you could use ADO objects and methods (in VBA code) to get data from an Access database for insertion into a Word document, and similarly to update the DB with data from the Word document. (Something similar may be possible with Word 97, using DAO, but am not sure.)

    It wouldn't be trivial to build as you're basically writing code to replace much of what the mailmerge does; anyway just thought I'd mention it for the sake of completeness.

    Gary

  5. #5
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Read from Word doc into Access database (97)

    Others have given you some suggestions, but pointed out some of the limitations in trying to do this sort of thing in Word. I would suggest you use Automation and not do any sort of mail merge. The primary reason I suggest that is that Word documents are by definition single user - if someone opens a document, and then someone else tries to open it, Word warns you and suggests it will make a copy of the document for you. Access on the other hand is multi-user, so several people can have the database open at the same time. Thus the scenario I would suggest involves creating a Word document from the Access database using Automation, but that document could never be edited, and would be recreated any time the necessary changes were made to the Access database.
    Wendell

  6. #6
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Read from Word doc into Access database (97)

    Wendell,

    It's refreshing to see a suggestion providing alternatives to my Word-centric worldview!

    Question: In the scenario you are sketching where the Word document is generated from Access via automation, will it be possible to provide a method whereby changes made to fields in the Word document, can be updated back into the Access DB table(s)?

    Gary

  7. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Read from Word doc into Access database (97)

    Hi Gary,
    In that approach, you probably wouldn't even use fields - bookmarks would be about the only "smart" objects in the document, and they aren't actually necessary. As far as I know, there isn't any method (i.e. an event) of identifying the fact that a field is being edited. You could do it by using a Word-based form, but you still have the issue of multiple users trying to edit it simultaneously. Thus I would make the Word doc read-only, and insist that all editing be done in Access. (The downside of course is that anyone who edits must have either Access or a runtime version of the database installed on their PC.) I'm actually working on a project something like this at the moment, but in this case people are submitting new records only, and not trying to edit existing records.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •