mail merge for a single record (1 Viewer)

ayh1

Registered User.
Local time
Today, 16:22
Joined
Dec 19, 2014
Messages
29
Hi I have an access .adp project which is linked to a sql server tables (2008 r2), I have a button on an access form which I click and successfully gets customer details based on a query. What I wanted to know is when I am viewing a specific record i.e. details for Patient Number X, when I click on a mail merge button from their record form can the mail merge document only open with their details not all customers?

I have tried to delve into vba and modules to acheive this but I am a newbie

thanks
 

mh123

Registered User.
Local time
Today, 16:22
Joined
Feb 26, 2014
Messages
64
Let's say your unique ID field was 'employeeID' copy the query you are already using, make a second one (rename it qryNameMerge or whatever you choose) and in this second query set the filter for the employeeID field to forms!yourformnamehere!employeeID then it will only have the record you are currently looking at. Obviously change employeeID to the name of the field which has your primary key.

This way when you press your mail merge button on your form, the query will only have the one record you need, as it opens with the filter applied for the record you are looking at.

HTH
 

ayh1

Registered User.
Local time
Today, 16:22
Joined
Dec 19, 2014
Messages
29
I get an error with:

Forms!frmPatientDetails!PatientID

it says data type error in expression, I am putting the above in the criteria under PatientID in my mail merge query
 

Users who are viewing this thread

Top Bottom