p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

access thread: Access 2000 opt groups


Message #1 by "Andy Summers" <andy@s...> on Mon, 24 Jun 2002 13:17:06
I'm a little baffled by option groups.  In Excel you used to be able to 
define an option button as being "on" (true) or "off" (false).  Now I have 
to give each button in the group a value.  But isn't the value of each 
button 1 or 2 or 3 etc whether there the button is selected ot not?

This came about when I was trying to pass on information from a form 
holding the option group to a report.  If Button 1 was selected then the 
currency label caption is "GBP", if 2 then the caption is "USD" but my 
second problem is how I get the caption on the form to change.  I'm 
familiar with VBA but I don't know whether I can't get to the cause 
because I'm not sure how to signify that a particular button is selected 
or not!

Thanks

Andy
Message #2 by "Amy Wyatt" <amyw@c...> on Mon, 24 Jun 2002 13:41:20
In an option group the value of each option button is actually what the 
value of the group becomes. For example, if you have 3 option buttons in a 
group and you click on the second (whos value equals 2) then the option 
GROUP's value becomes 2. The option buttons themselves are still simply 
boolean values (true or false) but in a group situations you would be 
checking the value of the group control to tell which button has been 
selected.

As for changing the caption on the label on the form, you lost me 
there...what label and what caption. If it is a label in the option group 
then I am not sure how you would change the label except for detaching the 
label that comes with the group option and defining it as a seperate 
lable. I know it is a problem accessing the labels of the option buttons 
in a group because I have tried it. Maybe someone else know how to do it 
without making the label a seperate control out side of the option group 
but that is the only way I know how to do it. Then you simply set the 
caption of the label (i.e. lblOne.Caption="USD"). If you are changing the 
label on the report based on the option chosen then you would only need to 
access that label. In a report, however, you need to specify 
lblOne.Caption (.Caption is required) or you will get an error. Not sure 
why but that is what I have experienced.

Hope this helps,

Amy

> I'm a little baffled by option groups.  In Excel you used to be able to 
d> efine an option button as being "on" (true) or "off" (false).  Now I 
have 
t> o give each button in the group a value.  But isn't the value of each 
b> utton 1 or 2 or 3 etc whether there the button is selected ot not?

> This came about when I was trying to pass on information from a form 
h> olding the option group to a report.  If Button 1 was selected then the 
c> urrency label caption is "GBP", if 2 then the caption is "USD" but my 
s> econd problem is how I get the caption on the form to change.  I'm 
f> amiliar with VBA but I don't know whether I can't get to the cause 
b> ecause I'm not sure how to signify that a particular button is selected 
o> r not!

> Thanks

> Andy
Message #3 by braxis@b... on Mon, 24 Jun 2002 13:32:51 +0100 (BST)
Andy

You need to look at the value of the Option Group itself. This will be equal to the value of the selected option.

Brian

>  from:    Andy Summers <andy@s...>
>  date:    Mon, 24 Jun 2002 14:17:06
>  to:      access@p...
>  subject: Re: [access] Access 2000 opt groups
> 
> I'm a little baffled by option groups.  In Excel you used to be able to 
> define an option button as being "on" (true) or "off" (false).  Now I have 
> to give each button in the group a value.  But isn't the value of each 
> button 1 or 2 or 3 etc whether there the button is selected ot not?
> 
> This came about when I was trying to pass on information from a form 
> holding the option group to a report.  If Button 1 was selected then the 
> currency label caption is "GBP", if 2 then the caption is "USD" but my 
> second problem is how I get the caption on the form to change.  I'm 
> familiar with VBA but I don't know whether I can't get to the cause 
> because I'm not sure how to signify that a particular button is selected 
> or not!
> 
> Thanks
> 
> Andy

Message #4 by "Andy Summers" <andy@s...> on Mon, 24 Jun 2002 14:11:20
Amy

Many thanks for this help...I think that the answer to the first will help 
me find a solution for the second which was, as you guessed, about 
changing a label on a report based on the value of the option buttons.

Somehow (doh!) I hadn't figured out that the group itself would hold the 
value of the selected item.

Many thanks.

Andy
Message #5 by "Andy Summers" <andy@s...> on Mon, 24 Jun 2002 14:12:35
Brian

Many thanks.  Tried and tested - just didn't realise that the group itself 
held the value.

Andy

  Return to Index