Accessing _RecipientControl1 (Assigned To)

  • Thread starter cmonroe21 via OfficeKB.com
  • Start date
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
 
S

Sue Mosher [MVP]

Try checking the value of Item.Recipients.Count instead. In general, you
should work with control property values only when you want to change the
appearance of a control or when the control is not bound to an Outlook
property.
 
C

cmonroe21 via OfficeKB.com

Works like a charm. Thank you! I think I was confused about the
_RecipientControl1 thing, good to know that I can bypass dealing with it!
Try checking the value of Item.Recipients.Count instead. In general, you
should work with control property values only when you want to change the
appearance of a control or when the control is not bound to an Outlook
property.
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
[quoted text clipped - 26 lines]
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top