Steve Conklin (Developer@UltraDNT)
Developer at UltraDNT.com
Wed Mar 2 11:21:39 CST 2005
Virginia:
You will need a proper record position of the desired record, ie, ES-23
= record # 23 in the query (or it doesn't) ...
Then once you have this number, the Word application needs to issue a
GoTo command, for that same number SECTION, not page - this is
important, a Word mail merge is numbered by sections for each record,
not by page - there's a Page 1 for each record.
Selection.GoTo What:=wdGoToSection, Which:=wdGoToFirst, Count:=<RECORD
#>, Name:=""
Hth
Steve
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Hollis,Virginia
Sent: Wednesday, March 02, 2005 11:33 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] Access to Word Merge
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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com