In the following example, letters are being prepared to mail to the parents of each future student who has an interview booked with the Head of Campus, using the crspFutureActivityPrint stored procedure.
An activity has been created on the Activity tab of Future Student Maintenance. See Future Student Maintenance - Activity tab in the Future students manual.
Image Removed Image Added In the example, the interview is booked with Sarah Adamski and her parents, as displayed on the:
- Activity tab (selected above)
- Modify Activity window (seen below).
Image Removed Image Added Activities are selected for the mail merge based on their
Activity and the
Mail Request field. However, if the
Mailed Date and
Mailed By fields are populated with values, this means that this activity has already has been printed.
The
Activity field codes are maintained in the
luActivity lookup table. In this example, INTBOOK has been created for interviews that have been booked. See
Maintaining lookup tables in the System maintenance manual.
Image Removed Image Added To create mail merge letters using a stored procedure, such as the
crspFutureActivityPrint procedure:
...
Step 1 of the Mail Merge tab is displayed on the document window.
Image Removed Image Added- Select the type of document you are working on.
...
Step 2 of the Mail Merge tab is displayed on the document window.
Image Removed Image Added- Select the starting document.
- Click Next: Select recipients.
Step 3 of the Mail Merge tab is displayed on the document window.
Image Removed Image Added - Click Browse.
The Select Data Source window is displayed.
Image Removed Image Added- Select Tools > MS Query.
The Choose Data Source window is displayed.
Image Removed Image Added- Select the Synergetic database you plan to use. That is:
...
- Clear the Use the Query Wizard to create/edit queries field.
Image Removed Image Added - Click Image Removed Image Added.
The SQL Server Login window is displayed.
Image Removed Image Added- Type in your username and password.
Note: This is your usual Synergetic username and password.
- Click Image Removed Image Added.
The Add Tables window is displayed.
Image Removed Image Added- Click Image Removed Image Added.
- Click Image Removed Image Added.
The SQL window is displayed.
- Type the stored procedure and its parameters. See Stored procedures (on page ) for details of each procedure. In this example, type:
- exec
- the procedure name, crspFutureActivityPrint
- the first parameter, @Activity='<code>', where <code> is the activity code required
- the second parameter, @Campus='<campus>', where <campus> is the campus required.
Image Removed Image Added Note: In this example we have omitted the campus parameter.- Click Image Removed Image Added.
The following dialog window may be displayed.
Image Removed Image Added- Click Image Removed Image Added.
The Microsoft Query window is displayed with the data returned by the stored procedure.
Image Removed Image Added - Select File > Return Data to Microsoft Word.
...
- Click Image Removed Image Added.
Step 4 of the Mail Merge tab is displayed on the document window.
Image Removed Image Added - Click More Items.
The Insert Merge Field window is displayed.
Image Removed Image Added- Locate and select the field to insert into the document.
- Click Image Removed Image Added.
The field is inserted in the document.
- Repeat steps 22 and 23 until all of the required fields are added to the document.
- Close the Insert Merge Field window.
- Add other text and format the letter.
Image Removed Image Added- Click Image Removed Image Added to view the merged data.
Image Removed Image Added- Format any database fields, such as date fields with the time included.
Tip: Right click and select Toggle Field Codes, to format the date, such as @ "d/mm/yyyy".
Image Removed Image Added- Preview the output and merge the letters.
- Save the document.
...