is it possible to launch outlook from a field in a form?

  • Thread starter Thread starter who me
  • Start date Start date
W

who me

Hi all and thanks in advance.

I have a data entry form which has a field where we enter email
address's of people we need to send an email to with a seperate word
document.

Is there a way with Access to set up a field in the form that will
start outlook and include the email address.
?

I hope I have explained what I am asking.,

Email replies or post to group thanks

Phil
 
Test this first. Create a new form. On this form create a
textbox and rename it txtEmailAddress. Create a command
button (Cancel the wizard) and change the name of it to
cmdEmail. Then on the View menu select Code.
Copy and paste the following:

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Const SW_NORMAL = 1

Sub SendMail(ByVal strAddress As String, _
Optional ByVal strCC As String, _
Optional ByVal strBCC As String, _
Optional ByVal strSubject As String, _
Optional ByVal strBodyText As String)
Dim strTemp As String
If Trim(Len(strCC)) Then
strTemp = "&CC=" & strCC
End If
If Trim(Len(strBCC)) Then
strTemp = strTemp & "&BCC=" & strBCC
End If
If Trim(Len(strSubject)) Then
strTemp = strTemp & "&Subject=" & strSubject
End If
If Trim(Len(strBodyText)) Then
strTemp = strTemp & "&Body=" & strBodyText
End If
If Len(strTemp) Then
Mid(strTemp, 1, 1) = "?"
End If
strTemp = "mailto:" & strAddress & strTemp
ShellExecute 0, "open", strTemp, 0, 0, 0
End Sub

Private Sub cmdEmail_Click()
SendMail (txtEmailAddress)
End Sub


This should launch your default composer and enter the
email address in the textbox as the adressee.
 
Back
Top