Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JimAA JimAA is offline
external usenet poster
 
Posts: 6
Default Entering parameter value in a mail merge

I have a Word template that uses an Access query with a parameter. When I
open the template to create a new document I get a dialog box that asks for
the parameter data. After entering the data I get the same dialog box asking
for the same parameter data. I'm assuming that I get a dialog box when the
template is opened and when the new document is opened.
Is there a way to avoid having to enter the same parameter data twice?
Thanks.
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Entering parameter value in a mail merge

Yes, this problem seems to occur in Word 2002 and later. I think the only
solution is to change the template so that it is not attached to the data
source, and use an AutoNew macro to open the data source when the new
document based on the template is created.

e.g. something like

Sub AutoNew()

Dim strPathName As String
Dim strConnect As String
Dim strQuery As String

' Put the pathname of your Access .mdb
strpathName = "c:\mydbs\mydb.mdb"

' Construct the Connect string

strConnect = "QUERY myquery"

' Construct the Query - you may also need WHERE and ORDER BY
' clauses for filtering and sorting

strQuery = _
"SELECT * FROM `myquery`"

' The following should be enough in Word 2003
' If you do not need WHERE clauses etc. you
' can delete the SQLStatement line

ActiveDocument.MailMerge.OpenDataSource _
Name:=strPathName, _
Connection:=strConnect, _
SQLStatement:=strQuery, _
Subtype:=wdMergeSubTypeWord2000

' Set the merge type you want
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters

' optionally set the destination you want
ActiveDocument.MailMerge.Destination = wdSendToNewDocument

End Sub

Peter Jamieson

"JimAA" wrote in message
...
I have a Word template that uses an Access query with a parameter. When I
open the template to create a new document I get a dialog box that asks
for
the parameter data. After entering the data I get the same dialog box
asking
for the same parameter data. I'm assuming that I get a dialog box when
the
template is opened and when the new document is opened.
Is there a way to avoid having to enter the same parameter data twice?
Thanks.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NO CODE - mail merge to Outlook with attachment with CC BrianH Mailmerge 1 February 10th 10 02:53 PM
My Email Mail Merge Does Not Work zombeese Mailmerge 0 May 19th 06 02:10 PM
Mail Merge Losing Data Scott May Mailmerge 1 November 1st 05 11:03 PM
Mail Merge - Parameter prompts twice... TL Mailmerge 6 June 17th 05 02:58 PM
mail merge with attachments AS Mailmerge 5 April 9th 05 09:49 AM


All times are GMT +1. The time now is 05:51 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"