Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Multiple Word docs in a form

Status
Not open for further replies.

OCSC

MIS
Dec 2, 2002
2
GB

I'm sure the answer is easy but I am struggling with this one.....

I am finding it easy to insert a link to a word doc in a form by creating an insert object and selecting the relevant file in the wizard. However upon clicking to the second recond in the form the word icon links to the same word doc as previous. How do I create a new link while maintaining the same word icon on the form?
 
Hmmm. I can't reproduce the problem. Can you describe in a bit more detail what's going on. There should be a table with an OLE Object field that is displayed on the form using a Bound Object Frame. When you right click on the frame, you should get an Insert Object option, that will allow you to create/choose the object, and either fully insert it, link to it, and optionally display it as an icon so it can be fired up in Word.

A good alternative, that requires 1)a bit of coding, and 2) a reliable folder structure, is to store paths to your files as plain strings, using the Common Dialog Control to get them in the first place, then using 'shell' to fire up word passing it the path of the file you want it to open.
This keeps your database size to a minimum, but will require a bit of research on your behalf.
 
Thanks for the response, am able to get it up and running now.
I'll try it the first way but need to be aware of the increasing size of the database, will it be able to hold 90+ word documents.............?
 
That's the great motivation for looking into storing the paths. I've meant to look into seeing if they can be stored as hyperlinks, as hyperlinks take up no more space that OLE bound frames, and since they're 'active' make it very easy to gain access to the docs. Just display them in a continuous form and the user can just click on one to open it. Joy!

I'm a bit buried with other stuff to look into it further right now, but let us know how you get on.

 
Hi,

I'm trying to insert a bound frame in a report to pull a word doc which is stored in an ole field of a table, but am having no luck getting it to print. Did you figure out how to do something like this? Any help you could offer would be greatly appreciated. Thanks.

Jeff
 
I'm working on a project where there are 800+ Word docs containing info on some instruments. I created a field in my Access instrument table that contains the Word doc file name of the corresponding Word doc for the instrument. On my form I created a button to bring up the doc in Word. The code follows:

Private Sub Procedure_Click()
DoCmd.Hourglass True
GetInstrPro Instpro:=Me![calibration information.Procedure]
DoCmd.Hourglass False
End Sub

Sub GetInstrPro(Instpro)
Dim appWord As Word.Application
Dim wd As String
On Error Resume Next
wd = "c:" & "\" & Instpro & ""
AppActivate "Microsoft Word"
If Err Then
Shell "c:\Program Files\Microsoft Office\Office\Winword /Automation", vbMaximizedFocus
AppActivate "Microsoft Word"
End If
On Error GoTo 0
Set appWord = GetObject(, "Word.Application")
With appWord
.Visible = True
.Documents.Open Filename:=wd
.ActiveDocument.ShowSpellingErrors = False
End With
Set appWord = Nothing
End Sub

I had them place all Word docs on the C:\ to make my code easier.

Neil
 
Forgot to mention. You must reference the Word application object library. In design view, do an ALT+F11 to enter VBA, click on Tools then References. Put a check next to Microsoft Word 9.0 Object Library.

Neil
 
Thank you, Neil. I appreciate you taking the time to help me, but rather than launching Word to view the documents, what I was hoping to do was have the Word doc simply visible within my report, kind of like an excel chart would be. Can this be done? Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top