S
Song Su
Access 2007
I want to specify SenderEmailAddress. When I add .SenderEmailAddress = "someone @ yahoo.com", it gives me "Can't assign read only property" error message when compiling. Here is my code:
Private Sub cmdEmail_Click()
If IsNull(Me.Email) Then
MsgBox "No email address.", , conAppName
Else
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Dim ctlBody As String
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
ctlBody = "Dear " & IIf([Sex] = "M", "Mr. ", "Ms. ") & StrConv([FIRSTName], 3) & " " & IIf(IsNull([M]), "", [M] & ". ") & StrConv([LASTName], 3) & ","
With objMail
' I insert code here but cannot compile
.To = Me.Email
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>" & ctlBody & "</p></BODY></HTML>"
.Display
End With
Set objMail = Nothing
Set olApp = Nothing
End If
End Sub
I want to specify SenderEmailAddress. When I add .SenderEmailAddress = "someone @ yahoo.com", it gives me "Can't assign read only property" error message when compiling. Here is my code:
Private Sub cmdEmail_Click()
If IsNull(Me.Email) Then
MsgBox "No email address.", , conAppName
Else
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Dim ctlBody As String
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
ctlBody = "Dear " & IIf([Sex] = "M", "Mr. ", "Ms. ") & StrConv([FIRSTName], 3) & " " & IIf(IsNull([M]), "", [M] & ". ") & StrConv([LASTName], 3) & ","
With objMail
' I insert code here but cannot compile
.To = Me.Email
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>" & ctlBody & "</p></BODY></HTML>"
.Display
End With
Set objMail = Nothing
Set olApp = Nothing
End If
End Sub