Option Group Control

G

Guest

Hello,

I have a form with a field called "DocType" which I created a options group
to fill this field in on my table. When I click on a choice: "Letter of
Credit", "New", "Renewal", only the value that was assigned by the option
wizard shows in my table. For reporting purposes this will be confusing. How
can I make it so when an option button is selected, the word shows up in the
table rather than the assigned value? Any help would be very much
appreciated. Please simplify answer.

Thanks to all!!
 
F

fredg

Hello,

I have a form with a field called "DocType" which I created a options group
to fill this field in on my table. When I click on a choice: "Letter of
Credit", "New", "Renewal", only the value that was assigned by the option
wizard shows in my table. For reporting purposes this will be confusing. How
can I make it so when an option button is selected, the word shows up in the
table rather than the assigned value? Any help would be very much
appreciated. Please simplify answer.

Thanks to all!!

Access is properly saving the Option value as a Number.
If you wish to show, in a report, query, or on a form, a text value
based upon the stored Option Group number, it's simple enough.
For example, in a form:
Add an Unbound Control to the Form.
Set it's Control source to (if there are just 3 options):

=IIf([OptionGroupName] = 1,"Letter of Credit",IIf([OptionGroupName]=
2,"New","Renewal"))

Or... you could use the Choose() function in the Control's Control
Source:
=IIf(IsNull([OptionGroupName]),"Nothing
Selected",Choose([OptionGroupName],"First Text","Second Text","Third
Text","Fourth Text","Fifth Text","etc."))

If you had many more options, then I would use a Select Case
statement in the Form Current Event as well as in the OptionGroup
AfterUpdate event:

Dim strText as String
Select Case OptionGroupName
Case is = 1
strText = "First Text"
Case is = 2
strText = "Second text"
etc.....
Case is = 15
strText = "Fifteenth Text"
Case else
strText = "Nothing Selected"
End Select
[ControlName] = strText
 
G

Guest

Hi fredg,

I'm sure I'm getting this. Currently, when I click on one of the options it
fills in a number in the table under the corresponding field like you said.
Instead of the number, I want the field to fill with the document name. Are
you saying I need to put a text field on the form next to the option groups
and use the code you gave me in the control source? Sorry, sometimes this
gets a little confusing for me.

Thank you!

fredg said:
Hello,

I have a form with a field called "DocType" which I created a options group
to fill this field in on my table. When I click on a choice: "Letter of
Credit", "New", "Renewal", only the value that was assigned by the option
wizard shows in my table. For reporting purposes this will be confusing. How
can I make it so when an option button is selected, the word shows up in the
table rather than the assigned value? Any help would be very much
appreciated. Please simplify answer.

Thanks to all!!

Access is properly saving the Option value as a Number.
If you wish to show, in a report, query, or on a form, a text value
based upon the stored Option Group number, it's simple enough.
For example, in a form:
Add an Unbound Control to the Form.
Set it's Control source to (if there are just 3 options):

=IIf([OptionGroupName] = 1,"Letter of Credit",IIf([OptionGroupName]=
2,"New","Renewal"))

Or... you could use the Choose() function in the Control's Control
Source:
=IIf(IsNull([OptionGroupName]),"Nothing
Selected",Choose([OptionGroupName],"First Text","Second Text","Third
Text","Fourth Text","Fifth Text","etc."))

If you had many more options, then I would use a Select Case
statement in the Form Current Event as well as in the OptionGroup
AfterUpdate event:

Dim strText as String
Select Case OptionGroupName
Case is = 1
strText = "First Text"
Case is = 2
strText = "Second text"
etc.....
Case is = 15
strText = "Fifteenth Text"
Case else
strText = "Nothing Selected"
End Select
[ControlName] = strText
 
F

fredg

Hi fredg,

I'm sure I'm getting this. Currently, when I click on one of the options it
fills in a number in the table under the corresponding field like you said.
Instead of the number, I want the field to fill with the document name. Are
you saying I need to put a text field on the form next to the option groups
and use the code you gave me in the control source? Sorry, sometimes this
gets a little confusing for me.

Thank you!

fredg said:
Hello,

I have a form with a field called "DocType" which I created a options group
to fill this field in on my table. When I click on a choice: "Letter of
Credit", "New", "Renewal", only the value that was assigned by the option
wizard shows in my table. For reporting purposes this will be confusing. How
can I make it so when an option button is selected, the word shows up in the
table rather than the assigned value? Any help would be very much
appreciated. Please simplify answer.

Thanks to all!!

Access is properly saving the Option value as a Number.
If you wish to show, in a report, query, or on a form, a text value
based upon the stored Option Group number, it's simple enough.
For example, in a form:
Add an Unbound Control to the Form.
Set it's Control source to (if there are just 3 options):

=IIf([OptionGroupName] = 1,"Letter of Credit",IIf([OptionGroupName]=
2,"New","Renewal"))

Or... you could use the Choose() function in the Control's Control
Source:
=IIf(IsNull([OptionGroupName]),"Nothing
Selected",Choose([OptionGroupName],"First Text","Second Text","Third
Text","Fourth Text","Fifth Text","etc."))

If you had many more options, then I would use a Select Case
statement in the Form Current Event as well as in the OptionGroup
AfterUpdate event:

Dim strText as String
Select Case OptionGroupName
Case is = 1
strText = "First Text"
Case is = 2
strText = "Second text"
etc.....
Case is = 15
strText = "Fifteenth Text"
Case else
strText = "Nothing Selected"
End Select
[ControlName] = strText

You are using Access, not Excel.
You are missing the concept of an Option Group in Access.
Access is supposed to save the group's number value.
There is no need to save a text value.
Saving the text value would simply waste memory, and make your life
harder when a change in the text is required.

To correctly use an option group, you would add to the group as many
radio buttons as are needed for each option. Let's say 3 options. Each
button will have a label. The label for the first option will read
"Letter of Credit". The label for the second option will read "New"
and the label for the third option will read "Renewal".

When you select, for example, the radio button next to the "New"
label, a value of 2 will be saved in your table. There is NO NEED to
save the word "New". Anytime, in your form, that you navigate to this
record, the radio button alongside the "New" label will show as
selected.

If you then change the option to "Letter of Credit", the new value of
1 will replace the previous value of 2 in the table. Whenever you then
navigate back to this record, the radio button alongside the "Letter
of Credit" label will now show as selected.

When you need to display the associated text of the option in a
report, you would then add an unbound control to the report.
Set it's control source to:
=IIf([OptionFieldName] = 1, "Letter of Credit",IIf(OptionFieldName]=2,
"New","Renewal"))
Now the actual text will appear in the report.
 
G

Guest

Hi Fredg,

Ok, I guess that's what I was getting at. So the number value should be in
the table. I will create the control and use the code you provided. Thank you
very much for staying with me on this and helping me along.

fredg said:
Hi fredg,

I'm sure I'm getting this. Currently, when I click on one of the options it
fills in a number in the table under the corresponding field like you said.
Instead of the number, I want the field to fill with the document name. Are
you saying I need to put a text field on the form next to the option groups
and use the code you gave me in the control source? Sorry, sometimes this
gets a little confusing for me.

Thank you!

fredg said:
On Mon, 28 Mar 2005 13:39:05 -0800, Kuya_D wrote:

Hello,

I have a form with a field called "DocType" which I created a options group
to fill this field in on my table. When I click on a choice: "Letter of
Credit", "New", "Renewal", only the value that was assigned by the option
wizard shows in my table. For reporting purposes this will be confusing. How
can I make it so when an option button is selected, the word shows up in the
table rather than the assigned value? Any help would be very much
appreciated. Please simplify answer.

Thanks to all!!

Access is properly saving the Option value as a Number.
If you wish to show, in a report, query, or on a form, a text value
based upon the stored Option Group number, it's simple enough.
For example, in a form:
Add an Unbound Control to the Form.
Set it's Control source to (if there are just 3 options):

=IIf([OptionGroupName] = 1,"Letter of Credit",IIf([OptionGroupName]=
2,"New","Renewal"))

Or... you could use the Choose() function in the Control's Control
Source:
=IIf(IsNull([OptionGroupName]),"Nothing
Selected",Choose([OptionGroupName],"First Text","Second Text","Third
Text","Fourth Text","Fifth Text","etc."))

If you had many more options, then I would use a Select Case
statement in the Form Current Event as well as in the OptionGroup
AfterUpdate event:

Dim strText as String
Select Case OptionGroupName
Case is = 1
strText = "First Text"
Case is = 2
strText = "Second text"
etc.....
Case is = 15
strText = "Fifteenth Text"
Case else
strText = "Nothing Selected"
End Select
[ControlName] = strText

You are using Access, not Excel.
You are missing the concept of an Option Group in Access.
Access is supposed to save the group's number value.
There is no need to save a text value.
Saving the text value would simply waste memory, and make your life
harder when a change in the text is required.

To correctly use an option group, you would add to the group as many
radio buttons as are needed for each option. Let's say 3 options. Each
button will have a label. The label for the first option will read
"Letter of Credit". The label for the second option will read "New"
and the label for the third option will read "Renewal".

When you select, for example, the radio button next to the "New"
label, a value of 2 will be saved in your table. There is NO NEED to
save the word "New". Anytime, in your form, that you navigate to this
record, the radio button alongside the "New" label will show as
selected.

If you then change the option to "Letter of Credit", the new value of
1 will replace the previous value of 2 in the table. Whenever you then
navigate back to this record, the radio button alongside the "Letter
of Credit" label will now show as selected.

When you need to display the associated text of the option in a
report, you would then add an unbound control to the report.
Set it's control source to:
=IIf([OptionFieldName] = 1, "Letter of Credit",IIf(OptionFieldName]=2,
"New","Renewal"))
Now the actual text will appear in the report.
 

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