Problem: Either there is no default mail client …

Problem: Either there is no default mail client …

In Access 2000, the following VBA code…

DoCmd.SendObject , , acFormatTXT, Me.Email, , , “Testing”, TheBody, 0

…generates the following error message:

Either there is no default mail client or the current mail client cannot fulfill the messaging request.  Please run Microsoft Outlook and set it as the default mail client.

The thing is, Microsoft Outlook 2000 IS set as the default mail client, under Settings > Control Panel > Internet Options > Programs > Email

So what must I do to get Access to send email?


Solution: Either there is no default mail client …

Hi,

I have created a new module, with a reference to the Outlook object model and written the following code:

Public Sub SendQualityEmail()

‘This code references the Outlook Object Model to send an email message
Dim strEmailAddress As String
Dim strMessageSubject As String
Dim strJobNumber As String
Dim strMessageText As String
Dim objOutlook As New Outlook.Application
Dim objMessage As MailItem

If Forms![FmJobs]![RequestStatus] <> “C” Then
MsgBox “You cannot send a Quality Email if the Job Status is not Completed.  ” _
, vbOKOnly, “Cannot Send Email”
Exit Sub

Else

‘Create the email address
strEmailAddress = Forms![FmJobs]![RequestorEmail] & “@epson-telford-ltd.co.uk”
Debug.Print strEmailAddress

‘Create the job number
strJobNumber = Forms![FmJobs]![JobNumber]
Debug.Print strJobNumber

‘Create the message subject text
strMessageSubject = “Job Number – ” & strJobNumber & “, has been completed”
Debug.Print strMessageSubject

‘Create the message text
strMessageText = “The F&P job, number: ” & strJobNumber & “, has been completed.  ” & Chr(13) & Chr(13)
strMessageText = strMessageText & “Please click on the following link, http://etl02366/asp/QualityQuestionnaire.asp and complete the F&P Quality Questionnaire.  ”
strMessageText = strMessageText & “Remember to quote the correct Job Number when completing the Questionnaire.  ” & Chr(13) & Chr(13)
strMessageText = strMessageText & “If you should have any difficulties or require any assistance completing the Questionnaire, ”
strMessageText = strMessageText & “please do not hesitate to contact F&P as soon as possible.” & Chr(13) & Chr(13)
strMessageText = strMessageText & “Regards,” & Chr(13) & Chr(13) & “Facilities & Properties Department”
Debug.Print strMessageText

‘Create the email message and send
Set objMessage = objOutlook.CreateItem(olMailItem)
With objMessage
.To = strEmailAddress
.Subject = strMessageSubject
.Body = strMessageText
.Send
End With

End If

End Sub

This procedure will allow the code to create a ‘virtual’ instance of Outlook and send a mail.  Using the SendObject method I found that I couldn’t send more than one email in a session without shutting down the application and starting it again.

I hope this helps.

Regards,

WIB