I cant seem to figure out why I keep getting "Runtime 287 Application-defined or object-defined error" when my code tries to send an outlook email. Here is my code currently for the form.
My Button Code
Code:
Private Sub SubmitButton_Click()
Call send_Breakdown
MsgBox "GPS Unit Diagnostics Information Successfully Entered Into The Database"
DoCmd.Close acForm, "Form_New_GPS_Diags"
End Sub
Outlook Code
Code:
Sub send_Breakdown()
Dim objOutLook As Object
Dim MailOutLook As Object
' Create the Outlook Session
Set objOutLook = CreateObject("Outlook.Application")
' Create the Message
Set MailOutLook = objOutLook.CreateItem(olMailItem)
mailroster = "abc@yahoo.com"
With MailOutLook
.To = mailroster
.Subject = "GPS Diagnostics Report!"
.body = "A GPS Diagnostics Test has been run on a possibly defective unit! The details of the test are listed below..."
.send
End With
Set objOutLook = Nothing
Set MailOutLook = Nothing
End Sub
Any help is much appreciated. I've been pulling my hair out over this cause it was working fine on Friday and nothing changed.