S
Song Su
Access 2007 SP2 on XP
When I click email button on the continues form, first time ok. 2nd time
shows runtime error 462 - the remote server machine does not exist or is
unavailable. It highlights Set objMail=olApp.CreateItem(olMailItem) Please
help. Thank you.
Private Sub cmdEmail_Click()
If IsNull(Me.Email) Or Len(Me.Email) < 8 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([First],
3) & " " & IIf(IsNull([M]), "", [M] & ". ") & StrConv([Last], 3) & ",<p>"
With objMail
.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
When I click email button on the continues form, first time ok. 2nd time
shows runtime error 462 - the remote server machine does not exist or is
unavailable. It highlights Set objMail=olApp.CreateItem(olMailItem) Please
help. Thank you.
Private Sub cmdEmail_Click()
If IsNull(Me.Email) Or Len(Me.Email) < 8 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([First],
3) & " " & IIf(IsNull([M]), "", [M] & ". ") & StrConv([Last], 3) & ",<p>"
With objMail
.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