how do I set make an option group set the value of some combo boxe

  • Thread starter Thread starter efandango
  • Start date Start date
E

efandango

I have an option group of four radio buttons:

Section 1
Section 2
Section 3
Section 4

with them I want to say:

If section 1 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 1
[Forms]![frm_Runs]![cbo_Point2Point_To] = 2

If section 2 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 3
[Forms]![frm_Runs]![cbo_Point2Point_To] = 4

If section 3 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 5
[Forms]![frm_Runs]![cbo_Point2Point_To] = 6

If section 4 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 7
[Forms]![frm_Runs]![cbo_Point2Point_To] = 8


I've never done an option box before, so need some help to get me started.
 
What are the values of the radio buttons associated with Sections 1,2, 3, 4?
If they are the same as the section number, then use the options groups
AfterUpdate event, something like (assuming that the option group is on form
frm_Runs:

Private sub og_Section_AfterUpdate

me.cbo_Point2Point_From = (me.og_Section * 2) - 1
me.cbo_Point2Point_To = me.og_Section * 2

End if

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
Dale,

That is vey neat and kind of minimalist with it... (and i'm not entirely
sure how it works...)

but, I used this:
Me.cbo_Point2Point_from = (Me.OptionGroup_Current_Book * 2) - 1
Me.cbo_Point2Point_To = Me.OptionGroup_Current_Book * 2


Though it works, I need some with more variable flexibility for future
variations.

Suppose I wanted to make something like this:


If section 1 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 1
[Forms]![frm_Runs]![cbo_Point2Point_To] = 70

If section 2 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 71
[Forms]![frm_Runs]![cbo_Point2Point_To] = 140

If section 3 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 141
[Forms]![frm_Runs]![cbo_Point2Point_To] = 210

If section 4 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 211
[Forms]![frm_Runs]![cbo_Point2Point_To] = 280




Dale Fye said:
What are the values of the radio buttons associated with Sections 1,2, 3, 4?
If they are the same as the section number, then use the options groups
AfterUpdate event, something like (assuming that the option group is on form
frm_Runs:

Private sub og_Section_AfterUpdate

me.cbo_Point2Point_From = (me.og_Section * 2) - 1
me.cbo_Point2Point_To = me.og_Section * 2

End if

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



efandango said:
I have an option group of four radio buttons:

Section 1
Section 2
Section 3
Section 4

with them I want to say:

If section 1 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 1
[Forms]![frm_Runs]![cbo_Point2Point_To] = 2

If section 2 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 3
[Forms]![frm_Runs]![cbo_Point2Point_To] = 4

If section 3 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 5
[Forms]![frm_Runs]![cbo_Point2Point_To] = 6

If section 4 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 7
[Forms]![frm_Runs]![cbo_Point2Point_To] = 8


I've never done an option box before, so need some help to get me started.
 
How about something like:


Private Sub OptionGroup_Current_Book_AfterUpdate

Select Case me.OptionGroup_Current_Book
Case 1
[Forms]![frm_Runs]![cbo_Point2Point_From] = 1
[Forms]![frm_Runs]![cbo_Point2Point_To] = 70
Case 2
[Forms]![frm_Runs]![cbo_Point2Point_From] = 71
[Forms]![frm_Runs]![cbo_Point2Point_To] = 140
Case 3
[Forms]![frm_Runs]![cbo_Point2Point_From] = 141
[Forms]![frm_Runs]![cbo_Point2Point_To] = 210
Case 4
[Forms]![frm_Runs]![cbo_Point2Point_From] = 211
[Forms]![frm_Runs]![cbo_Point2Point_To] = 280
Case Else
msgbox "invalid selection"
End Select

End Sub

Or, you could take the minimalist view:

Private Sub OptionGroup_Current_Book_AfterUdate

me.cbo_Point2PointFrom = ((me.optionGroup_Current_Book - 1) * 70) + 1
me.cbo_Point2PointTo = me.optionGroup_Current_Book * 70

End sub

BTW, you don't have to settle with the values that Access assigns to each
of the buttons. You could set the values for the various buttons as 0, 70,
140, 210
and then just add 1 and 70 to the values to get the values for the two combo
boxes.

HTH
Dale


efandango said:
Dale,

That is vey neat and kind of minimalist with it... (and i'm not entirely
sure how it works...)

but, I used this:
Me.cbo_Point2Point_from = (Me.OptionGroup_Current_Book * 2) - 1
Me.cbo_Point2Point_To = Me.OptionGroup_Current_Book * 2


Though it works, I need some with more variable flexibility for future
variations.

Suppose I wanted to make something like this:


If section 1 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 1
[Forms]![frm_Runs]![cbo_Point2Point_To] = 70

If section 2 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 71
[Forms]![frm_Runs]![cbo_Point2Point_To] = 140

If section 3 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 141
[Forms]![frm_Runs]![cbo_Point2Point_To] = 210

If section 4 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 211
[Forms]![frm_Runs]![cbo_Point2Point_To] = 280




Dale Fye said:
What are the values of the radio buttons associated with Sections 1,2, 3,
4?
If they are the same as the section number, then use the options groups
AfterUpdate event, something like (assuming that the option group is on
form
frm_Runs:

Private sub og_Section_AfterUpdate

me.cbo_Point2Point_From = (me.og_Section * 2) - 1
me.cbo_Point2Point_To = me.og_Section * 2

End if

--
HTH
Dale

Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



efandango said:
I have an option group of four radio buttons:

Section 1
Section 2
Section 3
Section 4

with them I want to say:

If section 1 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 1
[Forms]![frm_Runs]![cbo_Point2Point_To] = 2

If section 2 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 3
[Forms]![frm_Runs]![cbo_Point2Point_To] = 4

If section 3 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 5
[Forms]![frm_Runs]![cbo_Point2Point_To] = 6

If section 4 is clicked, then the values of:

[Forms]![frm_Runs]![cbo_Point2Point_From] = 7
[Forms]![frm_Runs]![cbo_Point2Point_To] = 8


I've never done an option box before, so need some help to get me
started.
 
Back
Top