• Word in access form (Access 2000 or greater)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Word in access form (Access 2000 or greater)

    Author
    Topic
    #407223

    I did this some years ago and have forgotten how to.

    I would like to have aa form based on a table which contsins the paths to winword docs. When I change the record I want to display the selected file in an embedded copy of winword on a form for the user to edit it.
    What object do I need on the form and how do I get it to update the contents based on the path selected.

    Viewing 3 reply threads
    Author
    Replies
    • #850059

      You can put an unbound object frame on the form, and link it to a Word document. You could then change its SourceDoc property in the On Current event of the form.

      But you’ll only see the first page of the Word document; you can’t scroll through it. If you enable the frame, the user can double click it to open Word. I don’t think that is what you intend.

      • #850078

        Thanks Hans.
        Thats what I tried without success. When I changed the record it didn’t update the doc. Do I need to force some event in the object?

        • #850081

          You must recreate the link:

          Me.OLEUnbound0.SourceDoc = Me.PathField
          Me.OLEUnbound0.Action = acOLECreateLink

          where OLEUnbound0 is the name of the OLE control, and PathField is the name of the text field containing the path+filename. The OLE control must be unlocked and enabled for this to work.

          Updating is very slow, though. You might be better off providing a hyperlink to the documents, so that the user can decide to open a document or not.

          • #850083

            Runtime error 2793

            I have the code in the Form_Current event (and no other code at all)

            • #850089

              Have you set Enabled to Yes and Locked to No for the OLE control? And did you set the OLE Type to Linked when you created the control? Otherwise, you’ll get runtime error 2793.

            • #850095

              A thousand thanks.

              (I feel a right idiot for not spotting that)

            • #850099

              Why do you think I could reply so quickly? smile I made the same mistake initially grin

            • #850100

              Why do you think I could reply so quickly? smile I made the same mistake initially grin

            • #850096

              A thousand thanks.

              (I feel a right idiot for not spotting that)

            • #850090

              Have you set Enabled to Yes and Locked to No for the OLE control? And did you set the OLE Type to Linked when you created the control? Otherwise, you’ll get runtime error 2793.

          • #850084

            Runtime error 2793

            I have the code in the Form_Current event (and no other code at all)

        • #850082

          You must recreate the link:

          Me.OLEUnbound0.SourceDoc = Me.PathField
          Me.OLEUnbound0.Action = acOLECreateLink

          where OLEUnbound0 is the name of the OLE control, and PathField is the name of the text field containing the path+filename. The OLE control must be unlocked and enabled for this to work.

          Updating is very slow, though. You might be better off providing a hyperlink to the documents, so that the user can decide to open a document or not.

      • #850079

        Thanks Hans.
        Thats what I tried without success. When I changed the record it didn’t update the doc. Do I need to force some event in the object?

    • #850060

      You can put an unbound object frame on the form, and link it to a Word document. You could then change its SourceDoc property in the On Current event of the form.

      But you’ll only see the first page of the Word document; you can’t scroll through it. If you enable the frame, the user can double click it to open Word. I don’t think that is what you intend.

    • #850289

      If you can make your Word docs RTF files then you can do exactly what you want using the Rich Text Control.

      The updating is instantious if you do it this way, and you can scroll.

    • #850290

      If you can make your Word docs RTF files then you can do exactly what you want using the Rich Text Control.

      The updating is instantious if you do it this way, and you can scroll.

    Viewing 3 reply threads
    Reply To: Word in access form (Access 2000 or greater)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: