Hi Sarah,
What you have described is best solved with the SendObject method. However,
a button next to each email address means a lot of repeated code and a
limitation on your form as far as adding more email contacts. A better
solution would be to have one button with the code executing with the click
event and either a listbox or a dropdown box retrieving the email address
from a table.
Rowsource for the listbox or combo box = "SELECT Mytable.Emailaddress,
Mytable.Name FROM MyTable;"
The click event code for the button would be something like:
Private Sub Command1_Click()
On Error GoTo Errtrp
Dim Ema As String
Erm = Me.List0 'replace list0 with the name of your control holding the
email names
DoCmd.SendObject acSendNoObject, , , ema, , , , , True
Exittrp:
Exit Sub
Errtrp:
Msgbox Err.number & ": " & Err.Description
Resume Exittrp
End Sub
The code will take whatever is highlighted in the listbox or selected in a
combobox and use the email address to open up your email client with the
address already populated.
What I have given you is fairly simple but you can create a lot more
variables to parse things like subject, message etc before opening the email
client.
Regards,
Nick
Sarah at DaVita said:
I go many responses but since I am new at this I don't really understand
them. Imagin a button next to each email address. If I click on the button
next to email2 then outlook would open a mail window with the To filled in as
the value of email2 and then the user will fill in the other fields and
attached what ever they need to.
:
Hi Sarah
From what I can understand, you want to compile a list of names for an
email. I have an email selection form that has a combo box with a list of
names, There are three columns, PersonNo, PersonName, EmailAddress. There
is another unbound text box called txtIndividualList. You select a name from
the combo, select a button which adds the name to the existing names in the
list. It then puts a semi colon after the name.
Me![txtIndividualList] = Me![txtIndividualList] &
Me![NameCombo].Column(2) & ";"
Does that answer your question?
:
I have a form that has a list of email addresses. I would like to put a
button next to each name so the user can just click and have an email open
with the address already entered. So I have..
Name1 Email1
Name2 Email2
So if someone clicks the button next to email1 then the value in that
control will be put into the email address to send. I know this can be done
but have not had any luck. Can someone give me a clue? Thanks.