Hollis,Virginia
HollisVJ at pgdp.usec.com
Wed Mar 2 10:33:27 CST 2005
The mail merge is getting the data from a query - not directly from a table.
But on the form, when you go to a specific record. I want a cmdButton that
will run the code to open the Word (mail merge) & show just the data for
that record. Right now the Word mail merge always opens to the first record
in the database & not the current record from the form.
I thought I would need some a statement in the code so the mail merge knows
which record to display for the data. If I want ES-1, the Word file opens to
ES-1. If I am on ES-23, the Word file opens to ES-23.
Virginia
**************************************************************
Virginia
I suggest you set the merge data of your doc to a temp table or a query
rather than direct to a main table. If a temp table you write the required
record to the tabel before opening the doc, then do the mailmerge. If you
base the doc on a query you ensure with the query's criteria that it uses
the right record. Either way the doc will then just open to the right
record.
--
Andy Lacey
http://www.minstersystems.co.uk <http://www.minstersystems.co.uk>
--------- Original Message --------
From: Access Developers discussion and problem solving
<accessd at databaseadvisors.com
<http://databaseadvisors.com/mailman/listinfo/accessd> >
To: accessd at databaseadvisors.com
<http://databaseadvisors.com/mailman/listinfo/accessd> <accessd at
databaseadvisors.com <http://databaseadvisors.com/mailman/listinfo/accessd>
>
Subject: [AccessD] Access to Word Merge
Date: 02/03/05 13:57
>
> I am using the below code to open a Word document. The user wants to use a
> Word document for the printed form. So I am trying to create a Mail Merge
> with the EquipSpec.doc.
>
>
>
> Is there a way to use this same code but include something that will open
> the Word document to the current record?
>
>
>
> Sort of like using the OpenReport to a certain record:
>
> DoCmd.OpenReport stDocName, acPreview, , "[EquipSpecID]="
&
> Me![EquipSpecID]
>
>
>
> Virginia
>
>
>
> ***********************************************
>
> Function GoToEquipSpecForm()
>
> 'Opens Spec Word document
>
> Dim objWord As Object
>
>
>
> Set objWord = CreateObject("Word.Application")
>
> objWord.Visible = True
>
>
>
> objWord.Documents.Open "C:Documents and
SettingsDesktopEQIPSPEC.doc", ,
> True
>
>
>
> Set objWord = Nothing
>
>
>
> End Function