Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can't assign value to Combo box Using VB6.0.

37 views
Skip to first unread message

Wong Yee Beng

unread,
Jan 27, 2000, 3:00:00 AM1/27/00
to
Hi,

I use Visual Basic 6.0 to update my Contacts in OL2000. The type of the
user-defined field "Countries" is Keywords in , whereas the type for
"BusinessAddressCountry" is text.

When I run the code as below , I received an error message stated that "
Type Mismatch: unable to coerce parameter value. outlook cannot translate
your string."

If Item.UserProperties("Countries") Is Nothing Then
Item.UserProperties("Countries") = Item.BusinessAddressCountry
Else
Item.BusinessAddressCountry = Item.UserProperties("Countries")
End If

The purpoose of this partial code is , I want both fields to have the same
values.

Since type of "Countries" is keywords, the second line of the code will
never be executed, and i don't know what's the keyword for empty value in
the drop down list box.

Could anyone help me ???????????

Thanks,
Fiona.

Sue Mosher [MVP]

unread,
Jan 28, 2000, 3:00:00 AM1/28/00
to
You cannot directly set the value of a custom Keywords data type field in
Outlook. See http://support.microsoft.com/support/kb/articles/q182/3/87.asp
for workaounds.

--
Sue Mosher
Author of
"Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
"Microsoft Outlook 2000 E-mail and Fax Guide"

Outlook and Exchange solutions at http://www.slipstick.com


Wong Yee Beng <won...@hitech.com.my> wrote in message
news:OZxVhQJa$GA...@cppssbbsa02.microsoft.com...

Phil Seeman

unread,
Jan 31, 2000, 3:00:00 AM1/31/00
to
True, it can't set it using VBScript. But if she really is using VB
to access it, then it can be accessed as a variant array.

In her example, she can do something like:

Dim CountryFld as Object
Dim CountryArray as Variant

Set CountryFld = Item.UserProperties.Find("Countries")
CountryArray = CountryFld.Value
If UBound(CountryArray) = -1 Then
ReDim CountryArray(0)
CountryArray(0) = Item.BusinessAddressCountry
CountryFld.Value = CountryArray
Else
Item.BusinessAddressCountry = CountryArray(0)
End If

I didn't test the above code specifically, but it should be pretty
close. :-)

P.S. to Fiona: Note that as a Keywords field, Countries could have
multiple values; the above code only sets the BusinessAddressCountry
to the first value, ignoring any others. If you need it to contain
all values, then you'd just need to loop through CountryArray.

Phil Seeman,
TeamScope
http://www.teamscope.com

0 new messages