Check SendObject in Help. You didn't mention where the additional recipients
would come from, but in general it would look something like this:
DoCmd.SendObject acSendNoObject, , , Me![ComboBox].Column(2), "(e-mail address removed)
; (e-mail address removed)", , "Message Subject", "Message Body"
A couple of notes before I get to how you would add this code: Anything
identified in Help as the default choice need not be included in the code.
acSendNoObject could be left out, but the comma needs to remain. Stop when
there is nothing more to add. Commas are placeholders between options. In
the example above there are two commas before "Message Subject". Bcc (blind
copy) recipients of the e-mail would be inserted between the commas, but
there are none. Without the second comma "Message Subject" would appear in
the Bcc line on the e-mail. Note that combo box columns are numbered 0, 1,
2, etc., so Column(2) is actually the third column.
Important: There are no line breaks in the code. Enter it all on a single
line.
Regarding the code, I don't think it is possible to run the code from the
form's On Close event. However, if you use a command button to close the
form you can add the code before the instruction to close the form. To do
that, in form design view right click the command button, click Properties,
click the Event tab, click On Click, and click the three dots. If you are
creating a new command button, continue by clicking Code Builder, OK. In
either case you will see a code window with text. If you see On Error GoTo
... at the top click below that and start typing the code. If it is a new
command button start typing where the cursor is blinking. A message may pop
up as you type, attempting to guide you through the process.
There are a lot of options, so post back if you have more questions.
AJ said:
I have a Combobox in my form named Team Leader. The combobox has 3 columns,
1= ID, 2=Name and 3 = Email Address. The combo box actually show column 2
only. I would like to have an email sent to the email address from column 3
when the form is closed. I know I need to make this an event procedure from
the property box of the form. Problem is that I know nothing about vba and
have no clue where to go from here. I would also like to program in a few
set email addresses in addition to the one it pulls from the combo box.
Any help is very much appreciated. Thank you.