putting mail id in To column of Outlook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field Consultant_Mail_Id (text data type) in the table
tblConsultants.I would like this mail id to go into To textbox in the
Outlook(Word) when I click/Double click in the form's control consisting this
mail id so that I just type the concerned matter in the Body of the mail and
click Send button to send the mail.
How do I do this?
 
Use docmd.sendObject

If the form's control was named txtConsultant_Mail_Id you might make a
subroutine like this.

Private Sub txtConsultant_Mail_Id_DblClick(Cancel As Integer)
Dim strEmailAddress As String

strEmailAddress = Me.txtConsultant_Mail_Id
DoCmd.SendObject , , , strEmailAddress

End Sub
 
An alternative if you are using outlook:

Here is an example:
Set o = CreateObject("Outlook.Application")

Set m = o.CreateItem(0)
m.To = me.txtConsultant_Mail_Id

' m.CC = email address for copies
' m.BCC = email adderss for Blind Copies

m.Subject = "whatever you want as the subject line "

' the body and attachments are commented out here because not
desired
'm.body = Chr(13) & Chr(13) & " Date: " & date & Chr(13) & Chr(13)
'm.attachments.Add ReportDir & exportName ' point to the full
address of attachment here
' There can be multiple of the above

m.display ' display shows email and the user has to press send button
' either use the "display" for user to send or "send" for access to
send it.
'm.send ' Send does it automatically with security from Outlook

Ron
 
Back
Top