Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / August 2003

Tip: Looking for answers? Try searching our database.

linking Word documents to Access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carolyn - 08 Aug 2003 18:02 GMT
Hi - I am trying to figure out a way to link MS Word
documents to records in Access.  I have no idea how to do
this, but ideally, I would like to be able to have Word
document icons on a form that I can click to launch Word
and open the corresponding document.  I'm not a
programmer, but someone directed me here from the general
questions section.  Is this possible?
Larry Daugherty - 09 Aug 2003 04:32 GMT
Hi Carolyn,

It was I who suggested you come here for help but now that I've read your
request more carefully (and went back and looked at the thread in
microsoft.public.access) I've changed my mind...  Sorree!

When I read your request before it seemed that the Treeview and ImageList
controls working together would do what you want - I still believe that they
would but now I believe it would be more time and trouble than you need and
it might have pushed your application in a dysfunctional direction.

Rather than me referring you all over the place, lets settle on a newsgroup
to work out your issues.  I think that microsoft.public.access would do or
even microsoft.public.access.forms but lets first explore what you're doing
and then settle on a newsgroup. :-)

At the time you're going to click a "Word" button will you already have one
or more records on a form (or subform) with some contextual info showing?
From your posting, I believe that you will.  Assuming that's so then

You'll need an additional field in your table to hold the Word document name
associated with the record.  You will have to work the issues as to the
location of the Word documents.  You can have some common root folder for
the .docs or you must include the full pathname for each document in the
table.

You need to decide whether you'll Shell() to Word or if you'll use
Automation - Look up Automation in Help.  I've had synchronizing issues with
Word and Automation and in one application the only way I could get things
to play together cleanly was to open a Word session when I started the
Access application and only closed it as the last thing before closing
Access.  Creating, printing and closing Word documents was no problem.

As to the "Word" command button I'll leave it to you to find a Word icon to
use - you should be able to one easily.   See if you can work out how to get
the icon on your command button.  The code you'll want behind it will be
determined by which path Shell/Automation you take.  I think you'll probably
take the Automation path.

You can decide where you'd like to continue this dialogue.  We could easily
go back to your original thread from a week or so back or we can continue
here..  Just this once I'll welcome an email to work that issue.  In any
case, the above posting should be a part of where we pick it up.

My apologies for sending you on a wild goose chase.  Hang in there, we'll
get it.

hth
Signature

-Larry-
--

> Hi - I am trying to figure out a way to link MS Word
> documents to records in Access.  I have no idea how to do
[quoted text clipped - 3 lines]
> programmer, but someone directed me here from the general
> questions section.  Is this possible?
Carolyn - 11 Aug 2003 18:30 GMT
Hi Larry,

Thanks so much for your response.  I am glad to have your
help.  I am happy to continue the discussion in whatever
newsgroup you think is best.  In response to your items
below, I can add the additional field for the Word
document name.  I'll probably have the full pathname, is
my guess, because the documents will be located in
different folders, depending on the record selected.  As
for the Shell() or Automation - Look Up, I'll go with
whatever you suggest.  I don't really know anything about
either one.  I looked up Automation in the Access help,
but I'm not sure what I'm looking for, so I didn't get
that far.

 
>-----Original Message-----
>Hi Carolyn,
[quoted text clipped - 54 lines]
>
>.
Larry Daugherty - 12 Aug 2003 06:06 GMT
Hi Carolyn,

   I'm going to cross post this to microsoft.public.access.  You can pick
it up there and we can drop out of ActiveXControl.

   If your users will normally be opening several Word documents, one after
another then Automation may be the best way to go.  If they'll be opening
just one Word document at a time or per session then Shell () may be the way
to go.

   Come to think of it, please write a paragraph or two describing what
your application is all about:  its purpose, your intended audience/users,
etc.  That should keep me and others who might take an interest from going
too far astray.

   Automation is the name that Microsoft gave to the process in which a
client/server relationship is established between two applications that use
VBA.  Usually that's two MS Office applications but there are 3rd party
applications that can also play one or the other client/server roles.  Given
what you can do with Automation, the Help coverage seems terse but it went
as far as it could go without getting into application examples.  In our
case, Access would be the client and Word would be the server.

   Shell() is a function that can open a different program and give it the
focus.

   I believe that Shell will do the job for you.

   The following is an excerpt (that I've further hacked a bit) from some
help that Doug Steele posted that solved someone's Shell() problem.

>-----Altered Message-----
'You need to ensure that you've got quotes around the file names in the
string you pass to 'Shell:

Dim strAppName as string
Dim strAppendFile as string
Dim strCmdText as string

strAppName = "C:\Program Files\YourMSOffice\Office\Winword.exe"
 '  the above is the fully qualified path to the executable file, in
quotes.

strAppendFile = "C:\Parent Folder\Child Folder\Document.doc"

strCmdText = Chr$(34) & strAppName & Chr$(34) & " " & Chr$(34) &
strAppendFile & Chr$(34)

Call Shell(CmdText, 1)

> end of  altered Message-----

   The above code should go into the OnClick event of the command button
onto which you've stuck your Word icon.  Be sure to surround the code with
your error handling code.  Also, you need to supply or alter the code to get
the right document pathname into strAppend.  Change the variable names to
suit your style.

Signature

-Larry-
--

> Hi Larry,
>
[quoted text clipped - 103 lines]
> >
> >.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.