[mso] Re: Access 2002: Relative Table Links?

  • From: "Ray Blake" <ray@xxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Tue, 17 Aug 2004 06:33:04 +0100

Thanks, Cathy, I'm running similar code now.

There are 2 easy ways to move data from the form to the doc - one way
for up to a dozen or so fields and another for more. First, for a small
number of fields, I would use code behind the form to write values to
custom properties of the Word doc, which would contain fields which
disply the appropriate custom properties in the appropriate places.

With more fields than that, I'd normally do a mail merge. I'd use a
maketable query, using a criterion to restrict it to the current record
selected on the form ('ID=frmMain!ID') and I'd have the DOT file linked
to the output table of this query as the merge recordsource. And here is
my issue, because I'd like to be able to automate that linking from the
Word end. It's easy to do from the Access end a number of ways - I put
the DOTs in the user's default template path, for example, and that's
where my Access code looks for them. But I still find myslef manually
linking the templates whenever I install a system with this
architecture, and I'd like a reliable way of getting Word to do this
itself, or getting Access to manipulate the DOTs appropriately.

Ray

------------------------------------
GR Business Process Solutions
Ray Blake
Head of Software Design
ray@xxxxxxxxx
Braedon
Newell Road
Hemel Hempstead
Herts HP3 9PD
tel: 01442 396518
fax: 01442 389353
www.grbps.com
------------------------------------


-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Cathy.Evans@xxxxxxxxx
Sent: 16 August 2004 22:34
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access 2002: Relative Table Links?



Ray, I'll give you the whole code on the form I use for same, someone
else worked out the code.  It is on the after update event of my list
box, which is populated by a table with the form title for the pick list
in column 1, and the actual document.dot in column 2.  All it needs is
whatever forms are in the table should be in a directory (any name you
give it-mine is called WordDoc) directly below the database directory
folder.  It does not matter the path/server, I can send it to the sites
and as long as they put the directory with same title as code, it will
find whatever forms are in there and loaded into your table.

My next step with this was going to be to find a way to set this up to
open the documents and be able to fill them with data from access, right
now I just got the first step of the relative path.  Some of this code
is for opening the word document as a new instance so any automation in
the document will be activated, and it will cause it to open in word as
document1, document2, etc., so the user is forced to give it a title,
thereby preserving the master form.  I would be very interested in the
mail merge part of it, I really want to push data from access to a word
form, but just haven't had time to fool with it yet, can't get free yet.

Hope this helps, Cathy

Private Sub cboForms_AfterUpdate()
   'set up error handler
   On Error GoTo cboForms_AfterUpdate_error

   'if nothing is picked on the list, exit
   If IsNull(Me.cboForms) Then Exit Sub

   Dim strFileName As String, oApp As Object
   strFileName = Me.cboForms.Column(1)

   'if Word is already running, use that instance
   'if not, create a new instance
   If fIsAppRunning("Word", True) = True Then
      'next line may not be necessary
      DoCmd.RunCommand acCmdAppMinimize
      Set oApp = GetObject(, "Word.Application")
   Else
      Set oApp = CreateObject("Word.Application")
   End If

   oApp.Visible = True
   oApp.Documents.Add Template:=CurrentProject.Path & "\WordDoc\" &
strFileName

   'exit sub before it gets to the error handler
   Exit Sub

cboForms_AfterUpdate_error:
   MsgBox Err.Description, , "ERROR " & Err.Number & "
cboForms_AfterUpdate"
   'press F8 to step through code -- comment (or remove) these lines
after debugged
   Stop
   Resume Next
End Sub


 

                      "Ray Blake"

                      <ray@xxxxxxxxx>          To: <mso@xxxxxxxxxxxxx>

                      Sent by:

                      mso-bounce@freelist      cc:

                      s.org

                      08/16/2004 04:35 PM      Subject:  [mso] Re:
Access 2002: Relative Table Links?                   
                      Please respond to

                      mso
..... 
 

 





On a related matter to this, I've been trying to find a way to automate
Word's location of its mail merge file link back to an Access table. A
relative link would be ideal. Anyone done this?

------------------------------------
GR Business Process Solutions
Ray Blake
Head of Software Design
ray@xxxxxxxxx
Braedon
Newell Road
Hemel Hempstead
Herts HP3 9PD
tel: 01442 396518
fax: 01442 389353
www.grbps.com
------------------------------------


-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Cathy.Evans@xxxxxxxxx
Sent: 16 August 2004 21:20
To: mso@xxxxxxxxxxxxx
Subject: [mso] Access 2002: Relative Table Links?


Is there a way to set up 'relative' table links to a database in the
same folder?  I have added a 'read only' version of the database used by
sites that has a very shortened menu where user can only view reports
and open forms.  However it will link to the main database tables for
the reporting, and I do not know the particulars on each site
server/directory, they are all set up slightly different.  I use below
line of code in my forms table that links to a relative directory for
the forms, but can I do same with the tables, and if so, how?  I'm
coming up blank in any searches for attempting this and hope it can be
done.  Thank you, Cathy

 (example of relative link to Word documents)  oApp.Documents.Add
Template:=CurrentProject.Path & "\WordDoc\" & strFileName








------------------------------------------------------------------------
-----------------------------
The information transmitted is intended only for the person
or entity to which it is addressed and may contain confidential and/or
privileged material. If you are not the intended recipient 
of this message you are hereby notified that any use, review,
retransmission, dissemination, distribution, reproduction or any action
taken in reliance upon this message is prohibited. If you 
received this in error, please contact the sender and delete the 
material from any computer.  Any views expressed in this message are
those of the individual sender and may not necessarily reflect 
the views of the company.  
------------------------------------------------------------------------
-------------------------------

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the
quotes) in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will
also allow you to change your email settings to digest or vacation (no
mail). //www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group,
send a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an
invitation with instructions.  Once you are a member of the files group,
you can go here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: