Mail Merge Button on Form

Starting a saved process from a button on your form is very simple

1. Have the code generated in the Process Designer.

1.1 Mail Merge > Tools > Process Designer

1.2 Select the process

Generate simple (1.3.a) or elaborate version (1.3.b) of the code

1.3.a menu: Process > Generate Code > Load process from XML

This generates the following code:

Sub Exec_Email()
    Dim ammCurrentProcesses As accessmailmerge.CurrentProcesses                                                                           
    Set ammCurrentProcesses = New accessmailmerge.CurrentProcesses
    ammCurrentProcesses("Email").Execute
    Set ammCurrentProcesses = Nothing                                                          
End Sub

1.3.b menu: Process > Generate Code > Use process classes only (see Programming mail merge processes)

The code below (copied from frmMain in the Demo Database) picks up the selected process (name) from the list (see Mail Merge List on Form)

Private Sub cmdMailMerge_Click()

    Dim strProcess As String
    If Not Len(lbxProcesses.Value) = 0 Then
        strProcess = lbxProcesses.Value
        RefreshProcesses
        ammCurrentProcesses(strProcess).Execute
    Else
        MsgBox "Select Mail Merge process"
    End If

End Sub