I have a contact database where I can send an email to a single contact or to a group of contacts based on a query - however I would like to add a checkbox function so if I decide I want to send an email only to a handful of people in one of my query lists, I can check their name and it will send.
The issue I'm having is I don't understand how to link the checkbox to the email addresses.
Thus far I have it set up so when the form based on the query is open (eg. only architects are contained in the form) a button can be clicked which opens the form in table view, check boxes can then be ticked accordingly, table saved and closed ... I want to then click a button so outlook opens with only selected contacts in the Bcc field.
I already have a code that will open outlook with ALL contacts from the query in Bcc and it goes like so:
Dim r As Recordset
Dim Email As String
Set r = CurrentDb.OpenRecordset("select Email from FranksFinanceBrokers")
Do While Not r.EOF
Email = Email & r(0) & ";"
r.MoveNext
Loop
If Err.Number = 2295 Then
Resume Next
End If
r.Close
DoCmd.SendObject acSendNoObject, Null, Null, "", "", Email, "", "", True, Null
End Sub
Is it possible I can adjust this code so it only uses the email addresses who have their checkbox ticked?
My thought was adjusting OpenRecordset line to Set r = CurrentDb.OpenRecordset("select Email from FranksFinanceBrokers where SendEmail = true") but this doesn't work.
Any suggestions would be greatly appreciated, especially as I don't really know how the checkboxes even work!
Thanks!
Afterthought: Also, is there anyway to be able to "select all" checkboxes instead of ticking each one individually? Similarly with a way to "unselect all" ??