email - really stuck need help

  • Thread starter Thread starter Naresh Nichani MVP
  • Start date Start date
N

Naresh Nichani MVP

Hi:

You could put code like this in a button

Application.FollowHyperLink "mailto:Themailaddress.whatever"

Regards,

Naresh Nichani
Microsoft Access MVP

Jade said:
hi i know this might be a really basic queston but im really stuck. how do
i create something that when clicked, takes the email address from a field
and inserts it in to the To field of my email program.
i know it requires VB programming but i havent a clue of the code please
help
 
hi i know this might be a really basic queston but im really stuck. how do i create something that when clicked, takes the email address from a field and inserts it in to the To field of my email program

i know it requires VB programming but i havent a clue of the code please help
 
I got this from Fred

You do not need to use the hyperlink datatype to send an
email to the address. Use a regular Text DataType instead
for the email address.

Code the Double-click event of the form control that shows
the field:

Application.FollowHyperlink "Mailto:" & [ControlName]

Making corrections to the text field is much easier than
editing a
hyperlink field.

Jim
-----Original Message-----
hi i know this might be a really basic queston but im
really stuck. how do i create something that when clicked,
takes the email address from a field and inserts it in to
the To field of my email program.
 
I am relaying an answer provided to me in this forum by
Cheryl Fischer. She wrote (with some modifications on my
part):
In your form's design view, right-click on your command
button, then select Properties from the pop-up menu. In
the properties sheet for that command button, find the
Click event and click anywhere on that line. You will see
a downward pointing arrow at the right edge of the line.
Click it and select Event Procedure. Then, look for the
small button to the right of the downward pointing arrow
which contains an ellipsis (three dots ...). Click this
button to open the code window for the Click event.
When the code window is first opened, it will look like
this:
Private Sub cmdSendEmail_Click(Cancel As Integer)
End Sub
(Note from Bruce: It might say something other than
(Cancel as Integer), or it might just be (). I don't
remember. Go with whatever it gives you there.)
You will want to insert the following lines after
the "Private Sub cmdSendEmail_Click(Cancel as Integer)"
line

Dim strEmail As String
strEmail = "mailto:" & Me![EmailField]
Application.FollowHyperlink Address:=strEmail

cmdSendEmail is the name of the command button in this
example. Give it whatever name you like, and substitute
that name above. [EmailField] is, as you would expect,
the name of the field on your form that contains the e-
mail address you want to use.
I have also had good success with SendObject (attached to
the button's On Click event, as above. Remove any text
wrapping from the code below):
DoCmd.SendObject acSendNoObject, , , Me!
[EmailField],Cc:,Bcc:, "Subject","Message Body"

You need all of the commas, but you don't need anything
between the commas. If you don't want anything in Cc:,
for instance, you still need ,, as a placeholder. Don't
bother to add commas after the last item. If all you need
is the email address field, you needn't bother with any
commas after that. Use fields from the form in any of
those spaces (e.g. Me![Subject] if the e-mail's subject is
contained in a field on the form named [Subject]. See
Help for more information on SendObject.
 
Back
Top