Please help. I have no clue why I'm getting an error that says 'object variable or with block variable not set"
I have a userform with several textboxes, checkboxes, and radio buttons on it. They are not all required. My goal is to get the values or captions of these controls to display in the body of an email.
The code below works fine as long as none of the checkboxes or textboxes are empty. What do I need to do to prevent this error?
I have a userform with several textboxes, checkboxes, and radio buttons on it. They are not all required. My goal is to get the values or captions of these controls to display in the body of an email.
The code below works fine as long as none of the checkboxes or textboxes are empty. What do I need to do to prevent this error?
Code:
If Me.optExisting.Value = True Then strBody = "****** style=" & "font face=calibri" & "font size=11" & ">" & "<b><i>Please refer to the details of the request below:</i></b>" & _
"<br><br>" & _
"********************************************" & _
"<b>" & Me.lblDate & ": " & "</b>" & Me.txtDate.Value & _
"<br><br>" & _
"<b>" & Me.lblBusinessNeed & ": " & "</b>" & Me.txtBusinessNeed & _
"<br><br>" & _
"<b>" & Me.lblProduct & ": " & "</b>" & Me.txtProduct & _
"<br><br>" & _
"<b>" & Me.lblCopyFrom & ": " & "</b>" & Me.txtCopyFrom & _
"<br><br>" & _
"<b>" & Me.lblExtend & ": " & "</b>" & Me.txtExtend & _
"<br><br>" & _
"<b>" & Me.lblAddDeal & ": " & "</b>" & Me.frameAddDeal.ActiveControl.Caption & _
"<br><br>" & _
"<b>" & Me.lblNewExist & ": " & "</b>" & Me.frameNewExist.ActiveControl.Caption & _
"<br><br>" & _
strBody = strBody & "****************Deal Information Below****************************" & _
"<br><br>" & _
"<b>" & Me.chkTerminal.Caption & ": " & "</b>" & Me.txtTerminal.Value & " - " & Me.frameTerminal.ActiveControl.Caption & _
"<br><br>" & _
"<b>" & Me.chkBlend.Caption & ": " & "</b>" & Me.txtBlend.Value & " - " & Me.frameBlend.ActiveControl.Caption & _
"<br><br>" & _
"********************************************" & "</BODY>"
End If