Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

Option Group Control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kuya_D - 28 Mar 2005 22:39 GMT
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!!
fredg - 28 Mar 2005 23:32 GMT
> Hello,
>
[quoted text clipped - 7 lines]
>
> 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
Signature

Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Kuya_D - 29 Mar 2005 17:29 GMT
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!

> > Hello,
> >
[quoted text clipped - 41 lines]
> End Select
> [ControlName] = strText
fredg - 29 Mar 2005 20:05 GMT
> Hi fredg,
>
[quoted text clipped - 52 lines]
>> 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.
Signature

Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Kuya_D - 29 Mar 2005 21:55 GMT
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.

> > Hi fredg,
> >
[quoted text clipped - 83 lines]
> "New","Renewal"))
> Now the actual text will appear in the report.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.