C
cmonroe21 via OfficeKB.com
I am creating a custom task form in OL2007, and I want to make sure the
"Assigned To" box (bound to the Assigned to field) is not empty when Send is
clicked. The name of the field associated with the Assigned To text box is
_RecipientControl1. How do I access this _RecipientControl1 box to check if
the value is null or not? And perhaps even to set it equal to a default
recipient via code if I choose to? I tried Item._RecipientControl1, Item.
UserProperties("_RecipientControl1"), and Item.UserProperties.Find
("_RecipientControl1"), but each time I run it with the below code there is
an error that "Object variable not set." Code doesn't make it to any message
boxes (see below). Any suggestions?
Sub cmdSend_Click()
Item.Assign()
'If Item._RecipientControl1 <> "" Then 'Trial 1: Invalid character
'If Item.UserProperties("_RecipientControl1") <> "" Then 'Trial 2:
Object Variable not set
If Item.UserProperties.Find("_RecipientControl1") <> "" Then 'Trial 3:
Object Variable not set
MsgBox "_RecipientControl1 <> NULL"
'Item.Send()
Else
MsgBox "_RecipientControl1 = NULL"
'MsgBox "Please assign task before sending."
End If
End Sub
P.S. sorry for the commenting, but thought it might shed some light on what
I've tried and what I'm trying to accomplish
"Assigned To" box (bound to the Assigned to field) is not empty when Send is
clicked. The name of the field associated with the Assigned To text box is
_RecipientControl1. How do I access this _RecipientControl1 box to check if
the value is null or not? And perhaps even to set it equal to a default
recipient via code if I choose to? I tried Item._RecipientControl1, Item.
UserProperties("_RecipientControl1"), and Item.UserProperties.Find
("_RecipientControl1"), but each time I run it with the below code there is
an error that "Object variable not set." Code doesn't make it to any message
boxes (see below). Any suggestions?
Sub cmdSend_Click()
Item.Assign()
'If Item._RecipientControl1 <> "" Then 'Trial 1: Invalid character
'If Item.UserProperties("_RecipientControl1") <> "" Then 'Trial 2:
Object Variable not set
If Item.UserProperties.Find("_RecipientControl1") <> "" Then 'Trial 3:
Object Variable not set
MsgBox "_RecipientControl1 <> NULL"
'Item.Send()
Else
MsgBox "_RecipientControl1 = NULL"
'MsgBox "Please assign task before sending."
End If
End Sub
P.S. sorry for the commenting, but thought it might shed some light on what
I've tried and what I'm trying to accomplish