A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

option group - is this possible?



 
 
Thread Tools Display Modes
  #1  
Old November 30th, 2005, 09:18 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default option group - is this possible?

Hi there

Thanks to all who helped with my last query - i am having difficulties
again!!(surprise!)

I would like to put an option group on my subform with 3 options. Only one
of the three options can be selected. If the first option is selected then i
would like to calculate a fee and return it to 2 text boxes on the subform.
If the second option is selected then i would like it to return "0" to both
boxes and if the third option is selected then i would like to return £70 to
one of the boxes and 0 to the other.

I have my calculation in a query already but i am unsure of where to go from
here. Is this even possible?

Any comments would be gratefully received (or pointing and laughing will do
to!!!!)

Thanks

Paula
  #2  
Old December 1st, 2005, 02:44 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default option group - is this possible?

Yes, this is possible. The part about only being able to select one of the
three items is no problem, that's exactly what an option group does for you.
The thing to remember about an option group is that it returns a number to
indicate which item was selected. It is then up to you to remember what item
1, 2, or 3 did so that you can react accordingly.

In this case, I would make the option group the bound control and the two
textboxes would be calculated controls. This will allow the option group
selection to be displayed when you go back to review the record. As you have
stated, the values of the textboxes are dependent on the selection of the
option group, so they will be calculated based on that selection. You can do
this calculation in the Control Source of the textboxes or you could create
two calculated fields in the form's Record Source query and bind the
textboxes to those calculated fields. The equation would be similar in both
cases.

Control Source for first textbox:
=IIf([OptionGroup1]=1, your calculation here, IIf([OptionGroup1]=2, 0,
70))

Checking for 3 isn't needed if you've set a Default Value for the option
group. If you haven't, then Null is a possibility and you'll need to check
for 3 so that Null doesn't return 70.

Control Source for second textbox:
=IIf([OptionGroup1]=1, your calculation here, IIf([OptionGroup1]=2, 0, 0))

--
Wayne Morgan
MS Access MVP


"PaulaCMT" wrote in message
...
Hi there

Thanks to all who helped with my last query - i am having difficulties
again!!(surprise!)

I would like to put an option group on my subform with 3 options. Only one
of the three options can be selected. If the first option is selected then
i
would like to calculate a fee and return it to 2 text boxes on the
subform.
If the second option is selected then i would like it to return "0" to
both
boxes and if the third option is selected then i would like to return 70
to
one of the boxes and 0 to the other.

I have my calculation in a query already but i am unsure of where to go
from
here. Is this even possible?

Any comments would be gratefully received (or pointing and laughing will
do
to!!!!)

Thanks

Paula



  #3  
Old December 1st, 2005, 08:50 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default option group - is this possible?

Hi Wayne

Thank you for your reply - it makes perfect sense!! The only problem i have
is that the calculation that i need to do is a nested IIf. Isn't there a
restriction on the amount of IIF's that can be used ??

I did try the code with only some of the IIf's from the calculation and it
did work beautifully with the few records i have input to test it but
obviously i will need all the IIf's in.

Any ideas? Thanks

Paula

"Wayne Morgan" wrote:

Yes, this is possible. The part about only being able to select one of the
three items is no problem, that's exactly what an option group does for you.
The thing to remember about an option group is that it returns a number to
indicate which item was selected. It is then up to you to remember what item
1, 2, or 3 did so that you can react accordingly.

In this case, I would make the option group the bound control and the two
textboxes would be calculated controls. This will allow the option group
selection to be displayed when you go back to review the record. As you have
stated, the values of the textboxes are dependent on the selection of the
option group, so they will be calculated based on that selection. You can do
this calculation in the Control Source of the textboxes or you could create
two calculated fields in the form's Record Source query and bind the
textboxes to those calculated fields. The equation would be similar in both
cases.

Control Source for first textbox:
=IIf([OptionGroup1]=1, your calculation here, IIf([OptionGroup1]=2, 0,
70))

Checking for 3 isn't needed if you've set a Default Value for the option
group. If you haven't, then Null is a possibility and you'll need to check
for 3 so that Null doesn't return 70.

Control Source for second textbox:
=IIf([OptionGroup1]=1, your calculation here, IIf([OptionGroup1]=2, 0, 0))

--
Wayne Morgan
MS Access MVP


"PaulaCMT" wrote in message
...
Hi there

Thanks to all who helped with my last query - i am having difficulties
again!!(surprise!)

I would like to put an option group on my subform with 3 options. Only one
of the three options can be selected. If the first option is selected then
i
would like to calculate a fee and return it to 2 text boxes on the
subform.
If the second option is selected then i would like it to return "0" to
both
boxes and if the third option is selected then i would like to return £70
to
one of the boxes and 0 to the other.

I have my calculation in a query already but i am unsure of where to go
from
here. Is this even possible?

Any comments would be gratefully received (or pointing and laughing will
do
to!!!!)

Thanks

Paula




  #4  
Old December 1st, 2005, 10:22 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default option group - is this possible?

On Thu, 1 Dec 2005 12:50:02 -0800, "PaulaCMT"
wrote:

I did try the code with only some of the IIf's from the calculation and it
did work beautifully with the few records i have input to test it but
obviously i will need all the IIf's in.


Try the Choose() function instead:

Choose([OptionGroup], result for 1, result for 2, result for 3,
etc.)

John W. Vinson[MVP]
  #5  
Old December 1st, 2005, 10:54 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default option group - is this possible?

Thank you John - that worked perfectly - and thank you Wayne too! I was
struggling to know where to start!

This forum is absolutely brilliant - i have managed to work out most of my
problems by searching through past posts. Thanks again.

(I may be back!!)

Paula

"John Vinson" wrote:

On Thu, 1 Dec 2005 12:50:02 -0800, "PaulaCMT"
wrote:

I did try the code with only some of the IIf's from the calculation and it
did work beautifully with the few records i have input to test it but
obviously i will need all the IIf's in.


Try the Choose() function instead:

Choose([OptionGroup], result for 1, result for 2, result for 3,
etc.)

John W. Vinson[MVP]

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Option Group Label Issue Jay Using Forms 8 November 8th, 2005 01:51 PM
Another option group problem Emma Using Forms 1 April 22nd, 2005 07:38 PM
Is it possible to show both "Yes" and "No" answers from a "yes/no" checkbox? Colin Foster New Users 28 March 18th, 2005 02:19 PM
Option Group to reports [email protected] Setting Up & Running Reports 2 January 17th, 2005 10:48 PM
Unbound option group writing text values... Davie P Using Forms 5 August 12th, 2004 03:49 PM


All times are GMT +1. The time now is 06:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.