How to use subform controls (fields) in Mail merge

Jajm1213

New member
Local time
Today, 12:07
Joined
Feb 6, 2013
Messages
7
Hello all,

I think I have an issue that should be simple to solve but I can't figure it out. :banghead:

I am user the 'super simple mail merge' that is called by a button. The problem I have is that some of the fields I want to use in my mail merge are on two subforms and not the parent form (Therefore I can't reference them in my template).

Is there a way to pass these subform fields over as well as the parent fields to be referenced in the mail merge?
 
Typically, subforms contain multiple records related to the current record on the main form. Which subform record contains the data you want to merge? You can only referenct the Current record with - Forms!mainform!subform1.Form!fld1. If you need to get to any other row, you need to open a recordset and loop through it. One option, if you need to merge all the records, is to write the loop and concatenate all the data you need from the subform into a string. Place the string into a hidden control on the form and that will allow you to send multiple rows of subform data to the mail merge.
 
Typically, subforms contain multiple records related to the current record on the main form. Which subform record contains the data you want to merge? You can only referenct the Current record with - Forms!mainform!subform1.Form!fld1. If you need to get to any other row, you need to open a recordset and loop through it. One option, if you need to merge all the records, is to write the loop and concatenate all the data you need from the subform into a string. Place the string into a hidden control on the form and that will allow you to send multiple rows of subform data to the mail merge.
 
That is correct, my subforms do have many records. Currently they only have one, but as time goes on there will be more (once they're added).

Currently my work around is a button on the parent form that opens a form (which filters a query and includes all of the required fields). On that form is another button for my "super simple mail merge". It works but it's messy hahah. (Forgive me, I just opened access and VBA for the first time in December-doing my best)

I'm currently working on trying to get the button process automated and hidden.
 

Users who are viewing this thread

Back
Top Bottom