
Signature
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
> >I am using Albert Kallal's mail merge to merge data from my database to
> > letters in Word. The problem is that when I click on a button on my form
[quoted text clipped - 22 lines]
> > Thanks
> > Mark- Hide quoted text -
Mark,
I normally make the query the recordsourse of the mail merge form and
not a table but you can just code the button something like the
following and it should work.
MergeNoPrompts "NameOfDocument.Doc", "DriveLetter:\PathOfDocument",
True, , ("select * from NameOfQuery")
Hope that helps.
Rick
magicdds- - 27 Apr 2008 06:52 GMT
This works well.
Thanks for your help.
I was wondering if you had a solution to this next kink in the puzzle.
The first field in the query is called LETTERNAME.
Each record has all the Merge Fields but the first field is LETTERNAME.
When clicking on the button on the form, the following code runs:
Dim strSQL As String
strSQL = "select * from DayFile"
MergeNoPrompts DLookup("LetterName", "Dayfile"), "C:\Documents and _ &
Settings\Mark\Desktop\NewGen\Word\", True, , strSQL
With that, a letter is created in Word for each record in the table DAYFILE.
However, the letter is the same for each record. That is, the letter that is
merged is the LETTERNAME specified in the first record.
Is there a way to get the letter to be the letter specified in the field
LETTERNAME for each record?
Thanks,
Mark
> > >I am using Albert Kallal's mail merge to merge data from my database to
> > > letters in Word. The problem is that when I click on a button on my form
[quoted text clipped - 34 lines]
>
> Rick