I want to draft an Outlook email from my Access form and have it display so I can edit and send from Outlook.
The code below works:
Private Sub Command210_Click()
Dim OlApp As Object
Dim olMailItem As Object
Set OlApp = CreateObject("Outlook.Application")
Set olMailItem = OlApp.CreateItem(0)
With olMailItem
.Subject = Me.CPN & ""& Me.WBPN
.Body = "this is a test"
.Display
End With
End Sub
But I get a run time error when I try to use text from a form textbox (named WBEmailFU) for the body of the email.
Private Sub Command210_Click()
Dim OlApp As Object
Dim olMailItem As Object
Set OlApp = CreateObject("Outlook.Application")
Set olMailItem = OlApp.CreateItem(0)
With olMailItem
.Subject = Me.CPN & ""& Me.WBPN
.Body = Me.WBEmailFU
.Display
End With
End Sub
I get a
run time error "Method 'Body' of object'_MailtItem' failed
The text box WBEmailFU is formatted as LongText. Why does it work when I define .body= "a text string" but not when .body is defined as a text field from my form?