Option button question

C

Cody Dawg

I looking to add 3 options buttons to a form:

Once option button 1 is selected, then a choice of option button 2 or 3 can
then be selected. So the only combinations are:

none selected
1 & 2
1 & 3
 
S

Sue Mosher [MVP]

What do you want to happen to the information after the selections are made?
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
C

Cody Dawg

Just using the option buttons for a contract status. In other words, the
first button is selected if you have presented the client a contract; then
the next 2 buttons would then be enabled to select whether the contract was
accepted or declined. We would then use those fields to sort in a custom
view.

ex:
-------------------------------------------------------------------------
| |
|
| o Contract Offered | oContract Accepted oContract Declined |
| |
|
-------------------------------------------------------------------------

~By the way - just bought your book "MS Outlook Programming" and love it -
it's very useful!


What do you want to happen to the information after the selections are made?
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP]

Are you thinking of storing this information in one field or more than one? Your choice will drive the controls you use on the form.
 
C

Cody Dawg

It would be one field for the first button, and then a second field for the
2 other buttons.

Are you thinking of storing this information in one field or more than one?
Your choice will drive the controls you use on the form.
 
S

Sue Mosher [MVP]

Then I'd make the first button a check box and then use a pair of option buttons for the second two, both buttons bound to the same Outlook property. You can use the CustomPropertyChange event to toggle the state of the option buttons, based on what the user does with the checkbox.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
C

Cody Dawg

Unfortunately, this looks like it needs a Visual Basic script. I was hoping
to be able to do this through the tools provided in the design form
function. Would the code be difficult to write? I have some simple
programming experience.

Thanks

Then I'd make the first button a check box and then use a pair of option
buttons for the second two, both buttons bound to the same Outlook property.
You can use the CustomPropertyChange event to toggle the state of the option
buttons, based on what the user does with the checkbox.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
C

Cody Dawg

When I run the following code I get an "Run-time error 424: object required"

Sub CheckBoxOffered_Click()
Dim myInspector As Outlook.Inspector
Set myInspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("General")
Set FrameDecision = myPage1.Controls("FrameDecision")
Set CheckBoxOffered = myPage1.Controls("CheckBoxOffered")
FrameDecision.Visible = CheckBoxOffered.Value
End Sub



The code is pretty trivial. See http://www.slipstick.com/dev/propsyntax.htm
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
S

Sue Mosher [MVP]

What is the name of the property bound to the checkbox? (You need to be using a bound control; otherwise, Outlook won't store the data.) You should work with that property, not with the control properties itself. The event handler you need to use is Item_CustomPropertyChange, not control_Click, since you're working with a bound control. So, for example, if the property (not the control name) is a Boolean custom property named Offered, the code might be:

Sub Item_CustomPropertyChange(ByVal Name)
Dim myInspector
Select Case Name
Case "Offered"
Set myInspector = Item.GetInspector
Set myPage1 = myInspector.ModifiedFormPages("General")
Set FrameDecision = myPage1.Controls("FrameDecision")
FrameDecision.Visible = Item.UserProperties("Offered")
'more Case blocks for more properties
End Sub

Also note that Outlook form code is VBScript, hence typed variable declarations are not allowed.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 

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