Option Group

  • Thread starter Thread starter Guest
  • Start date Start date
Sorry, you can't do that. It requires a number. There are tricks you can
use that would give you the same effect. One would be to use the Chr()
function on a numeric return. For example, let's say you wanted to return
"A", "B", or "C". You could do this:
Set the Option Values of your controls in the Option Group to 65, 66, and 67
Then:
txtRetVal = Chr(Me.opgChoice)

If you need more text than that, you could use the Switch() function to
convert the value of the Option Group to whatever text you need.

txtRetVal = Switch(Me.opgChoice = 1, "First Choice", Me.opgChoice = 2,
"Second Choice", Me.opgChoice = 3, "Third Choice")
 
How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
Fredg,

I think your Choose method is the best idea. I also thing using nested IIfs
is never a good idea.

fredg said:
How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

fredg said:
How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

j1eggert said:
I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

fredg said:
How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
Does this mean I need to create a text box calle Me.MyTextBox on the form? I
am not sure I am understanding.

Klatuu said:
You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

j1eggert said:
I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

fredg said:
On Wed, 6 Jul 2005 07:51:01 -0700, j1eggert wrote:

How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
It doesn't have to be names that. You can substitute your own name for it.
What, exactly are you trying to do? Where do you want this text to show up?

j1eggert said:
Does this mean I need to create a text box calle Me.MyTextBox on the form? I
am not sure I am understanding.

Klatuu said:
You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

j1eggert said:
I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

:

On Wed, 6 Jul 2005 07:51:01 -0700, j1eggert wrote:

How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
Here are the specifics:

I have a form that has two option groups. The form clears itself after you
have entered the appropriate fields and pressed Enter. I want the radio
buttons in the option group to fill in the fields in the table rows with the
names on the labels, for each radio button, instead of a whole number. I hope
this helps.

Klatuu said:
It doesn't have to be names that. You can substitute your own name for it.
What, exactly are you trying to do? Where do you want this text to show up?

j1eggert said:
Does this mean I need to create a text box calle Me.MyTextBox on the form? I
am not sure I am understanding.

Klatuu said:
You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

:

I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

:

On Wed, 6 Jul 2005 07:51:01 -0700, j1eggert wrote:

How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
Okay, one other question I should have asked, Is the form a bound form or an
unbound form? This will make a difference in how we do this.

j1eggert said:
Here are the specifics:

I have a form that has two option groups. The form clears itself after you
have entered the appropriate fields and pressed Enter. I want the radio
buttons in the option group to fill in the fields in the table rows with the
names on the labels, for each radio button, instead of a whole number. I hope
this helps.

Klatuu said:
It doesn't have to be names that. You can substitute your own name for it.
What, exactly are you trying to do? Where do you want this text to show up?

j1eggert said:
Does this mean I need to create a text box calle Me.MyTextBox on the form? I
am not sure I am understanding.

:

You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

:

I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

:

On Wed, 6 Jul 2005 07:51:01 -0700, j1eggert wrote:

How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
Actually, with the help of a coworker, we were able to figure it out. We
created a query, which solved the problem. Thanks for your help.

James Eggert

Klatuu said:
Okay, one other question I should have asked, Is the form a bound form or an
unbound form? This will make a difference in how we do this.

j1eggert said:
Here are the specifics:

I have a form that has two option groups. The form clears itself after you
have entered the appropriate fields and pressed Enter. I want the radio
buttons in the option group to fill in the fields in the table rows with the
names on the labels, for each radio button, instead of a whole number. I hope
this helps.

Klatuu said:
It doesn't have to be names that. You can substitute your own name for it.
What, exactly are you trying to do? Where do you want this text to show up?

:

Does this mean I need to create a text box calle Me.MyTextBox on the form? I
am not sure I am understanding.

:

You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

:

I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

:

On Wed, 6 Jul 2005 07:51:01 -0700, j1eggert wrote:

How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
Gosh, just when I was about to get an answer to my question... please finish
the answer.. my form is bound to my table. The table doesn't have to have the
text, the number value is okay, but when I create my report, I'd like the
report to display the actual text as the number value won't mean anything to
a committee. Thank you!!!

j1eggert said:
Actually, with the help of a coworker, we were able to figure it out. We
created a query, which solved the problem. Thanks for your help.

James Eggert

Klatuu said:
Okay, one other question I should have asked, Is the form a bound form or an
unbound form? This will make a difference in how we do this.

j1eggert said:
Here are the specifics:

I have a form that has two option groups. The form clears itself after you
have entered the appropriate fields and pressed Enter. I want the radio
buttons in the option group to fill in the fields in the table rows with the
names on the labels, for each radio button, instead of a whole number. I hope
this helps.

:

It doesn't have to be names that. You can substitute your own name for it.
What, exactly are you trying to do? Where do you want this text to show up?

:

Does this mean I need to create a text box calle Me.MyTextBox on the form? I
am not sure I am understanding.

:

You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

:

I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

:

On Wed, 6 Jul 2005 07:51:01 -0700, j1eggert wrote:

How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
You must create individual Update Queries, in the Update To place the text
and in the Criteria place the corresponding number. Reference the table
associated with your option group. After this is completed, create a lookup
table and name it whatever your option group name is. Then in datasheet view
list the specific items in the option group. Reference the lookup table to
the option group name in your main table. Hope this helps.

James E.

Jan said:
Gosh, just when I was about to get an answer to my question... please finish
the answer.. my form is bound to my table. The table doesn't have to have the
text, the number value is okay, but when I create my report, I'd like the
report to display the actual text as the number value won't mean anything to
a committee. Thank you!!!

j1eggert said:
Actually, with the help of a coworker, we were able to figure it out. We
created a query, which solved the problem. Thanks for your help.

James Eggert

Klatuu said:
Okay, one other question I should have asked, Is the form a bound form or an
unbound form? This will make a difference in how we do this.

:

Here are the specifics:

I have a form that has two option groups. The form clears itself after you
have entered the appropriate fields and pressed Enter. I want the radio
buttons in the option group to fill in the fields in the table rows with the
names on the labels, for each radio button, instead of a whole number. I hope
this helps.

:

It doesn't have to be names that. You can substitute your own name for it.
What, exactly are you trying to do? Where do you want this text to show up?

:

Does this mean I need to create a text box calle Me.MyTextBox on the form? I
am not sure I am understanding.

:

You only need one of the lines of code provided. They all accomplish the
same thing; however, I believe that Fredg's Choose method is the very best.
Where you put it depends on where you want to see it. It could go in the
After Update of the option group to put it in a text box:
Me.MyText Box =Choose([OptionGroupName],"First Text","Second Text", "Third
Text")

:

I am sorry for my ignorance, but these code options you have provided are not
yielding any results. Where do I enter the first code you provided? And,
likewise the second code. Do I enter the code in the AfterUpdate in the
option group properties?

:

On Wed, 6 Jul 2005 07:51:01 -0700, j1eggert wrote:

How do I alter the option value to return text?

An Option Group returns a number value.

You can display a text in place of the number by using an unbound
control, in your report, or on a form:

=Choose([OptionGroupName],"First Text","Second Text", "Third Text")

The above will exchange the 1, 2, or 3 number value with the
appropriate text.

You could also use an IIF() statement:
=IIf([OptionGroupName] = 1,"First Text",
IIf([OptionGroupName]=2,"Second Text","Third Text"))
 
Back
Top