View Single Post
  #5  
Old November 10th 08, 03:20 PM posted to microsoft.public.outlook.program_forms
Rod Behr
external usenet poster
 
Posts: 4
Default Drop-down list loses its value (Outlook 2003)


Hi Ken

Again, thank you. You are assuming that my list of values has an incremental
primary key, which is natural from the list I gave you. The primary key is
not incremental, so the ListIndex property won't work.

So let's say my list of values is:

Fred, 13
Jim, 4
Arnold, 54

These values are assigned to an array and the array assigned to the .list
property of myControl, which is a ComboBox. This all in the Item_Open()
function of the form.

When I use the form to enter an outlook item (it's a celendar item), the
ComboBox's .list property populates fine. I select Jim and myField's value is
correctly set to 4. I close the item.

When I open it again, myControl has no value. I use MsgBox to display the
value and get an error because the value is null. Another control
(myControl2), just a Text Box, not a ComboBox, correctly displays the value
of myField as 4, but try as I might I cannot assign the value 4 to the
ComboBox.

When I attempt to set myControl's value as follows:

myControl.value = 4

I get the error, "Could not set the Value property. Invalid property value."

Why?

Thanks again for the help!

"Ken Slovak - [MVP - Outlook]" wrote:

Where is the code running that sets up the drop-down control? In that
procedure put in code something like this, assuming that your user property
is named "myField":

ctrl.list = myArray

Dim i 'As Integer

i = Item.UserProperties("myField")

ctrl.ListIndex = i - 1

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Rod Behr" wrote in message
...
Ken

Thanks for the response.

My background is in VBScript (Access and ASP), so my experience of Outlook
scripting is limited. Please could you expand on what you have written.
How
would I go about doing this?

Thanks



Ads