How to display a Word document in Access (1 Viewer)

Gkirkup

Registered User.
Local time
Today, 12:38
Joined
Mar 6, 2007
Messages
628
How do I display a Word document or PDF document in Access?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:38
Joined
Oct 29, 2018
Messages
21,491
You could try using a web browser control.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:38
Joined
Feb 19, 2002
Messages
43,335
How do I display a Word document or PDF document in Access?
Open it? Look at FollowHyperlink

We need more context. Are you asking about displaying the document inside a form?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:38
Joined
Feb 28, 2001
Messages
27,218
Open it for what purpose? Display only? Open for editing? Please specify intended action.

Further note: You can ONLY open a PDF document for display unless you have an Adobe product that can open and edit such files. The same is true for Word documents - you need Word to open and edit the document. However, there are "viewers" that allow you to open Word or PDF documents for viewing.
 

Gkirkup

Registered User.
Local time
Today, 12:38
Joined
Mar 6, 2007
Messages
628
I want it to display various Word documents. No editing required. I already know how to display photographs in Access, and that works fine.
I have so far not been able to display .doc or .pdf documents. I have converted a document to jpg which does work but it is very limited and I can only display one page at a time.
The document can be inside a form if that helps. Nothing else would be on the form.
I did Chat GPT the question and it suggested an Acrobat Reader control or a web browser control. I tried both but they require the OLE library which so far I do not have. Is that easy to install?
Thank you! Robert
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:38
Joined
Oct 29, 2018
Messages
21,491
I have so far not been able to display .doc or .pdf
I've seen pdf displayed inside a browser control. Have you tried that? Not sure if it will work with a Word doc though, but you could give it a try.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 20:38
Joined
Feb 19, 2013
Messages
16,629
want it to display various Word documents. No editing required.
So to be quite clear you want to see them on an access form - since ‘want it to display…’ could mean that or it could mean open in word

Word (and excelyou need to convert to a pdf to view on a form in a web browser

This can be done with automation to open the document hidden then save as a pdf

may be different if you are using the new edge browser control.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:38
Joined
Feb 28, 2001
Messages
27,218
From a display viewpoint, here is a question for you. Is it OK if, for the duration of this display, the document is open full-screen or in its own window? And is Word installed on the machines where you want to do this? And are all of the documents available as Word documents? (You had mentioned PDF documents, but was that for option purposes or because you have a mixed bag?)

I ask all that because it is not that hard to open a Word application object, open a specific document in READ-ONLY mode (so you don't have to worry about saving anything), and then closing Word when the user closes the document. I've done this more than once and it is actually relatively easy.
 

Gkirkup

Registered User.
Local time
Today, 12:38
Joined
Mar 6, 2007
Messages
628
Thank you. That sounds good. Read only is all that I want, and the Word doc full screen or in its own window would be quite OK.
Can you tell me how to do that?
Robert
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:38
Joined
Feb 28, 2001
Messages
27,218
Here is a sample from another forum that is short, sweet, and to the point.


When the Word document fills the screen, it also "overlays" (and thus hides) Access. When the user clicks the CLOSE button ([X] in upper right corner) then Access is revealed again and at most a mouse click on any control will get its attention again.
 

Gkirkup

Registered User.
Local time
Today, 12:38
Joined
Mar 6, 2007
Messages
628
Doc Man: Thank you so much. I had seen something similar but I found that WordApp needs the Microsoft Word Object Library. I used to have a list of Add-ins, but now the list is empty. I will get the server techs to reinstall the Microsoft add-ins.

Robert
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:38
Joined
Sep 21, 2011
Messages
14,350
If you have Word on the computers, then you just add the libary in Tools/references?
That link is actually using late binding anyway, so you do not even need to do that, but you do have to have Word on the computer?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:38
Joined
Feb 28, 2001
Messages
27,218
I used to have a list of Add-ins, but now the list is empty. I will get the server techs to reinstall the Microsoft add-ins.

The trick is that those add-ins usually include "translators" that allow your app to understand another app's creations. Which is WHY you need the Word library to open app objects, and there is a "display-only" translator (that is smaller - sometimes called "lightweight" - that knows how to read and display something but it cannot do anything else. Most web browsers, for example, bring along as part of their baggage an Adobe Reader app or an Adobe web translator app.

If YOU are removing add-ins, stop and take note of the usefulness of such things. If your IT staff (server techs) are doing it, you might need to let them know you will need those things for document display/translation services.
 

MsAccessNL

Member
Local time
Today, 21:38
Joined
Aug 27, 2022
Messages
184
You can show a word document in an Ole object control. There are posts about this being a bad idea, but a client of mine is working with iit for several years now, without problems. May be the control gave problems in the older Access versions?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:38
Joined
Feb 19, 2002
Messages
43,335
Did you try the FollowHyperlink method? The benefit of that code is that it allows Windows to select the program to use to display the file. Every other method requires that you open the document using the correct program. Here it is in context.

Code:
Private Sub txtViewAuditDoc_Click()
On Error GoTo Proc_Err
    If Me.txtViewAuditDoc & "" = "" Then
        MsgBox "There is no document link.  Please add one on the Audit Parms form.", vbOKOnly + vbInformation
    Else
        Application.FollowHyperlink Me.txtViewAuditDoc, , True
    End If
Proc_Exit:
    Exit Sub
Proc_Err:
    Select Case Err.Number
        Case 7971
            Resume Proc_Exit
        Case Else
            MsgBox Err.Number & "--" & Err.Description, vbCritical
            Resume Proc_Exit
    End Select
End Sub
 

Users who are viewing this thread

Top Bottom