Combo Box Relation

D

David Bowman

Sure I was trying to do the same thing.
The solution I came up with is not that elegant.
<Is that the Microsoft Way?>

Setup the first combo box the way you want it.

<combo box1>

<Command Button>

<Combo Box 2>

So you choose something in the first list box, Click the
Button (Lame I Know) then your second Combo Box gets to
have the right stuff in it.

I was trying to name the Sub ("Sub ComboBox1_Click()") so
the code would actually execute when someone clicked on
it <ComboBox1> but It did not seem to work.

Can you make the following code execute _every_ time
someone touches ComboBox1????????

Please post how...


Sub CommandButton1_Click()
' Sets FormPage equal to the page (P.2)
Set FormPage = Item.GetInspector.ModifiedFormPages
("P.2")
' Sets Control to a ListBox called ComboBox1.
Set Control = FormPage.Controls("ComboBox1")
' Read what they picked as a choice for main category
mycat = FormPage.Controls("ComboBox1")
' Real time message for TESTING....
MsgBox "Your varible mycat has the following data in
it " & mycat

' Assign values to the new Combobox2
Set Control = FormPage.Controls("ComboBox2")
If mycat = "01 GEN REQUIREMENTS" then
Control.PossibleValues = "Blue;Green;Red;Yellow"
End If
If mycat <> "01 GEN REQUIREMENTS" then
Control.PossibleValues
= "Big;bigger;biggest;shit"
End If
end sub
 
D

David Bowman

"Should" work? How does one tell if a combobox is/is not
bound to an Outlook Property?? Specificaly a ComboBox.
i.e. If I click on Advanced properties of said ComboBox,
is there something to look for that indicates if it IS
bound or NOT? I cannot tell If it is "bound" to an
Outlook property.

I used the following code from your site. I run the
Form, and change the values in ComboBox1 and I do _not_
get the message. Must I publish the form first for this
to work? This is the *only* code I have for the form.
I have a dropdown box called ComboBox1, with 3 possible
values.


Sub ComboBox1_Click()
Set objPage = Item.GetInspector.ModifiedFormPages("P.2")
Set objControl = objPage.Controls("ComboBox1")
MsgBox "The value in the " & objControl.Name & _
"control has changed to " & objControl.Value & "."
End Sub


-----Original Message-----
This should work if the combobox is not bound to an
Outlook property. See
http://www.slipstick.com/dev/propsyntax.htm#unbound.
 
S

Sue Mosher [MVP]

Right-click the control, bring up its Properties dialog, then look on the Value tab to see whether it's bound to a field.

Yes, you should publish the form. Code does not run on unpublished forms if the Outlook Email Security Update is in place.
 

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

Similar Threads


Top