View Single Post
  #4   Report Post  
Posted to microsoft.public.access.formscoding,microsoft.public.word.mailmerge.fields
magicdds-[_2_] magicdds-[_2_] is offline
external usenet poster
 
Posts: 9
Default Albert Kallal Mail Merge from a query

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



"Rick A.B." wrote:

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
to
open the mail merge form, the mail merge form uses the table that the form
is
based on to get mergefields.


If I click on a button on the form which opens a second form, If form #2
is
based on the query that I want to use to merge, I can have a button on
form#2
that opens the mail merge form. The the mail merge form uses the query
that
form#2 uses as the record source as the source for the merge fields.


I would like to use the query that form #2 has as the record source, as
the
source for the merge fields. I was wondering if there was a way to click
on a
button on form #1 (which uses a table as it's record source) to open the
mail
merge form and use the query as the source for the mergefields, without
opening form #2?


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