How to bind control fields to an Option Group?

G

Guest

On my main form, I'm trying to bind a field called "term_mos" to 2 option
buttons: 1) in months and 2) in weeks so that I can calculate an ending date.
I used the option group and boxed in the 2 option buttons, but it allows me
to select both. My current code is:

if option=1 Then
Enddate=DateAdd("m",[term_mos],[StartDate])
else
Enddate=DateAdd("ww",[term_mos],[startDate])
End If

Would this go under before Update event procedure?

Help!

thank you.
 
D

Dirk Goldgar

gg said:
On my main form, I'm trying to bind a field called "term_mos" to 2
option buttons: 1) in months and 2) in weeks so that I can calculate
an ending date. I used the option group and boxed in the 2 option
buttons, but it allows me to select both. My current code is:

if option=1 Then
Enddate=DateAdd("m",[term_mos],[StartDate])
else
Enddate=DateAdd("ww",[term_mos],[startDate])
End If

Would this go under before Update event procedure?

Help!

thank you.

It sounds like you went about creating your option group the wrong way.
Create the *option group frame* first, and then add your buttons to that
frame (or let the Option Group Wizard do it for you). Otherwise, all
you're left with is three independent controls: two unrelated option
buttons and an empty option frame.
 
R

Rick Brandt

gg said:
On my main form, I'm trying to bind a field called "term_mos" to 2
option buttons: 1) in months and 2) in weeks so that I can calculate
an ending date. I used the option group and boxed in the 2 option
buttons, but it allows me to select both. My current code is:

if option=1 Then
Enddate=DateAdd("m",[term_mos],[StartDate])
else
Enddate=DateAdd("ww",[term_mos],[startDate])
End If

Would this go under before Update event procedure?

Your ToggleButtons are not "in" the option frame if you can select both of
them. It is not sufficient to draw the frame "around" existing
ToggleButtons. New ToggleButtons can be Dragged and Dropped into an
OptionGroup frame if you are careful to see the frame's background change
colors before you Drop. Existing ToggleButtons have to be Cut to the
clipboard and then you select the OptionGroup, then Paste.

The test is to make sure that if you move the Option group that the
ToggleButtons all move as well.
 
G

Guest

Thank you, Dirk and Rick. It worked out great!

Rick Brandt said:
gg said:
On my main form, I'm trying to bind a field called "term_mos" to 2
option buttons: 1) in months and 2) in weeks so that I can calculate
an ending date. I used the option group and boxed in the 2 option
buttons, but it allows me to select both. My current code is:

if option=1 Then
Enddate=DateAdd("m",[term_mos],[StartDate])
else
Enddate=DateAdd("ww",[term_mos],[startDate])
End If

Would this go under before Update event procedure?

Your ToggleButtons are not "in" the option frame if you can select both of
them. It is not sufficient to draw the frame "around" existing
ToggleButtons. New ToggleButtons can be Dragged and Dropped into an
OptionGroup frame if you are careful to see the frame's background change
colors before you Drop. Existing ToggleButtons have to be Cut to the
clipboard and then you select the OptionGroup, then Paste.

The test is to make sure that if you move the Option group that the
ToggleButtons all move as well.
 

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