Two buttons let you quickly select (or deselect) all the contacts; once you have selected the email
recipients, and entered the message subject and body, you can click the Create Email Messages but-
ton to create the set of emails and open them for review before sending. A set of email messages is
shown in Figure 4.8.
FIGURE 4.8
A set of email messages created from an Access form.
The code that creates the email messages (and also the code that selects or deselects ListBox items)
is listed here:
Private Sub cmdMergetoEMailMulti_Click()
On Error GoTo ErrorHandler
Set lst = Me![lstSelectContacts]
Check that at least one contact has been selected:
If lst.ItemsSelected.Count = 0 Then
MsgBox “Please select at least one contact”
lst.SetFocus
GoTo ErrorHandlerExit
End If
Part I The Office Components and What They Do Best