I am trying to add code to the close button of my form to send an auto email and at the bottom of the email I want a hyperlink which will open a document. This is what I have but I keep getting error 91 object variable or with block variable not set. Also I would like to add a blank line between the message text and the hyperlink - how do I do this?
Private Sub cmdClose_Click()
Dim strmessage As String
Dim hyppath As Hyperlink
strmessage = Me.txtdetails
hyppath = Me.txtHyperlink
On Error GoTo Err_cmdClose_Click
DoCmd.SendObject , , , "Smith John", , , "New Cleaning Complaint received", strmessage + hyppath, False
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub
Private Sub cmdClose_Click()
Dim strmessage As String
Dim hyppath As Hyperlink
strmessage = Me.txtdetails
hyppath = Me.txtHyperlink
On Error GoTo Err_cmdClose_Click
DoCmd.SendObject , , , "Smith John", , , "New Cleaning Complaint received", strmessage + hyppath, False
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub