Mail Merge Question

andy_dyer

Registered User.
Local time
Today, 20:01
Joined
Jul 2, 2003
Messages
806
Hi,

Previosuly I have managed one mail merge and that was pulling info off the form I was on and transplanting it into a word letter...

This one is a little more complicated...

I have two combo boxes

cboPractice

cboGPName

depending on what practice is selected in cboPractice I have got it to show only the relevant GP's in cboGPName.

I want to do a mail merge that picks up the GP Name from cboGPName which is fed by tblGP and the Practice Name & Address that are right for the practice showing in cboPractice which is fed by tblPracticeAddresses.

I can manage to get the GPID by using the code;

.GoTo what:=wdGoToBookmark, Name:="recipient"
.TypeText ([Forms]![frmInput]![cboGPName])

How do I get it to pick up the name column instead of the ID column?

How do I get it to pick up the name and address of the practice from a completely seperate table?

Any suggestions would be gratefully received!!

Thanks

Andy
 
How are you planning to do this mail merge? The best way is to export a query as a mail merge document.

Bad News. You have wasted time in getting your combos to work. Only one combo is needed and that is the one which defines the practice.


Create a query which combines your GP table and your Practice table. Make sure there is a join between practice ID in both tables in the query grid.

Select the Name information from the GP table. Select the address details from the Practice table. Run this query to make sure that all names correspond to the right practice addresses.

Add the practiceID from the Practice table to the query grid. (This does not have to display). In the Criteria row under this column, put:

[Forms]![frmInput]![cboPractice]

(What you have entered is called a parameter.)

Now save the query as qryGPPractice.


Go to your form. On the after Update event, put this code:

DoCmd.OpenQuery "qryGPPractice"

If you change the value in the combo box, the correct records corresponding to the practice should open in the query.


Now all you have to do is export the query as detailed in Help.

There is another way to do this using an SQL statement instead of a parameter, but let's leave that for another time.
 
Thanks once more AncientOne!!

I have managed to get this mail merge working now by combining the tables into a query, and using this as the datasource for the mail merge document.

Thanks again!

Andy
 
you could also refer to [Forms]![frmInput]![cboPractice].column(1) for column 2 in your combobox. (zero based array)
 

Users who are viewing this thread

Back
Top Bottom