Results 1 to 6 of 6
  1. #1
    pk2317 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    9

    Access 2007: Trying to display multi-page Word document within control

    What I'm trying to do:



    Within my database, I have a table with approximately 80 entries. Each entry is associated with a Word document and up to 2 Excel documents. The majority of the Word documents are 2-3 pages long.

    I also have a form that contains a dropdown list for the primary key on this table. When a user selects a value from that list, I need to have the associated Word document appear in a control on that form, with scroll bars on the side.

    Ideally, I would like to have a separate form where the user can select a number from a dropdown, and then can switch between the Word document and the 2 Excel documents using command buttons, and have them display within a control on the form. However, if this proves too difficult, this secondary form can just launch the files in their native applications in a separate window (which I already know how to do).

    My limitations:

    The back-end of the database is going to be stored on a Sharepoint site, so I cannot use the OLEObject field in my table, because it does not support it.

    It doesn't make a huge difference if the files are stored within the database (as Attachments) or externally (as separate files with links stored as text). But I can't just cut & paste the data, because these documents will likely need to be modified in the future, and they need to continue to be stored as Word files.

    If I do store them as attachments, Sharepoint will only allow a single file for each record in the table (even though Access allows multiple attachments as a multi-value field). I have two workarounds, one is a separate table with three records tied to each primary key value, and another field distinguishing what type of file they are (so I can retrieve the right file using an SQL query). Alternatively, I can just store the Word document as the single attachment, and link to the external Excel files (which is slightly more confusing, but doable).

    The problem with attachments is that, as far as I can tell, the "attachment" control on the form does not actually display the attachment, unless it's an image. From my research online, it seems that for non-image files it only displays an icon representing the file, which you can double-click to open. I want the contents of the document to display.

    For a while it seemed like using an Unbound Object Field and linking to the separate file would work, and it almost does. The problem is that it only returns the first page of the document, and almost all the documents are 2-3 pages.

    My thoughts:

    I've considered creating a temporary table through VBA code, creating a record containing an OLEObject field, and importing the file data to display it in a Bound Object Field. However, I don't know if that will work with Sharepoint, or if it will drastically slow down performance every time someone changes their selection.

    I've also considered converting the file data to a BLOB, and trying to import and display it that way. I don't know a whole lot about this, or if it's a good idea or not.

    Is it possible to convert on-the-fly the contents of a Word document to, say, HTML so it can be displayed in a RichText Memo textbox? This might also be a solution, as long as everything displayed correctly. It probably wouldn't work as well with the Excel files, but the Word file is my main concern.

    Thank you very much for taking the time to read this and give me your feedback, if this is in the wrong forum please move it as necessary.

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    In my humble opinion you are swimming up stream with this concept of putting a complex application (yes - Word is a complex application, as is also Adobe Acrobat) inside a simple db control. I don't view this as even an Access question per se but more a conceptual one.

    Because when you say "I want the contents of the document to display" - Word isn't a display application it is complex editing application (which of course has to display so you can see what you are doing...). So it is very problematic attempting to put an entire application inside a control.

    A passive jpg or a gif (ie. image file ) makes sense. An application (Word/Acrobat/Excel) does not. This is why the Attachment field and hyperlink field exist. To launch the native application in a separate window - - and now that big screens are often found people have no problem with using separate windows....This approach is the native way the OS is intended to solve your task. Attempting to put an application thru an Access control is like putting an elephant thru a keyhole.

    Just one guy's opinion.

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    see here for additional ideas: https://www.accessforums.net/forms/u...rame-8710.html

    too much of this is going to get you confused: http://www.access-programmers.co.uk/...d.php?t=200301

  4. #4
    pk2317 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    9
    Quote Originally Posted by NTC View Post
    In my humble opinion you are swimming up stream with this concept of putting a complex application (yes - Word is a complex application, as is also Adobe Acrobat) inside a simple db control. I don't view this as even an Access question per se but more a conceptual one.

    Because when you say "I want the contents of the document to display" - Word isn't a display application it is complex editing application (which of course has to display so you can see what you are doing...). So it is very problematic attempting to put an entire application inside a control.

    A passive jpg or a gif (ie. image file ) makes sense. An application (Word/Acrobat/Excel) does not. This is why the Attachment field and hyperlink field exist. To launch the native application in a separate window - - and now that big screens are often found people have no problem with using separate windows....This approach is the native way the OS is intended to solve your task. Attempting to put an application thru an Access control is like putting an elephant thru a keyhole.

    Just one guy's opinion.
    First off I want to thank you for your input. I don't necessarily disagree with you, but for what I'm looking for it really isn't necessary to have the entire application within a control. All that I really need is the text with the formatting, which Access should be able to display within a Rich Text memo field. If there is a quick and easy way to convert a Word file to an HTML file on the fly, and import that to display in a text box, that solution would be totally fine with me.

    I would like to point out that Access 2007 does support opening Word documents from within a control, it's the Bound Object control, which opens an embedded OLE Object (like a Word document). The only problem with this is that it requires the underlying field to be an OLE Object field, which isn't supported on Sharepoint. Otherwise I'd gladly just use that and be happy

  5. #5
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    Right, but what you are looking for - and what is technically taking place - are 2 different things. This type post occurs regularly where people just want to 'see' a Word doc or pdf or excel - - and then struggle with it attempting to use it in a control. (particularly multipage docs) My explanation is why the struggle occurs, because although you just want to 'just view' the doc - that doesn't change the technical fact that the entire functional application is opening inside a control which is why one struggles to 'just view'.

  6. #6
    pk2317 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    9
    Quote Originally Posted by NTC View Post
    Right, but what you are looking for - and what is technically taking place - are 2 different things. This type post occurs regularly where people just want to 'see' a Word doc or pdf or excel - - and then struggle with it attempting to use it in a control. (particularly multipage docs) My explanation is why the struggle occurs, because although you just want to 'just view' the doc - that doesn't change the technical fact that the entire functional application is opening inside a control which is why one struggles to 'just view'.
    Thanks for the input.

    It's looking like what will work much better for my purposes is just to have the document be an RTF file instead, and then just import the text and formatting to display in a TextBox with RichText format. If you can help me out with the syntax for that, I'd be very grateful.

    https://www.accessforums.net/forms/h...tbox-8753.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-29-2014, 09:58 PM
  2. Open a word document from access
    By natalia in forum Programming
    Replies: 1
    Last Post: 10-13-2010, 08:04 AM
  3. Replies: 7
    Last Post: 08-31-2010, 12:15 PM
  4. Replies: 5
    Last Post: 07-16-2010, 10:12 AM
  5. Word document INTO Access form
    By jonathonhicks in forum Forms
    Replies: 0
    Last Post: 04-30-2007, 05:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums