I have an Access application which sends messages via Outlook. All works well except that when Outlook closes and the user is returned to Access, the original message is still on the form. I would like the form to be cleared and ready to accept new data. Below is the code used. Any suggestions? Thanks Much
Private Sub CmdEmail_Click()
'This will not activate the Outlook security warnings.
'It will open the email message in outlook and
'the message can be sent by clicking on the SEND button.
'This also allows the sender to add to the message.
Dim strWAEmail, strWABody, strWASubject As String
Dim objOutlook As Object
Dim objEmail As Object
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
strWAEmail = Me!Email
strWASubject = "Phone Message"
strWABody = "You received a phone Call at:" & Chr(13) & " " & Me![MessDate] & " " & Me![MessTime] & Chr(13) & _
Chr(13) & "FROM: " & Me![FirstName] & " " & Me![LastName] & _
Chr(13) & "Of:" & " " & Me![Company] & " , " & Me![AreaCode] & " - " & Me![PhoneNumber] & Chr(13) & " " & Me![Message]
With objEmail
.To = strWAEmail
.Subject = strWASubject
.Body = strWABody
.Importance = olImportanceHigh
.Display
End With
Set objEmail = Nothing
End Sub
Private Sub CmdEmail_Click()
'This will not activate the Outlook security warnings.
'It will open the email message in outlook and
'the message can be sent by clicking on the SEND button.
'This also allows the sender to add to the message.
Dim strWAEmail, strWABody, strWASubject As String
Dim objOutlook As Object
Dim objEmail As Object
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)
strWAEmail = Me!Email
strWASubject = "Phone Message"
strWABody = "You received a phone Call at:" & Chr(13) & " " & Me![MessDate] & " " & Me![MessTime] & Chr(13) & _
Chr(13) & "FROM: " & Me![FirstName] & " " & Me![LastName] & _
Chr(13) & "Of:" & " " & Me![Company] & " , " & Me![AreaCode] & " - " & Me![PhoneNumber] & Chr(13) & " " & Me![Message]
With objEmail
.To = strWAEmail
.Subject = strWASubject
.Body = strWABody
.Importance = olImportanceHigh
.Display
End With
Set objEmail = Nothing
End Sub