Solved

Option box in Access

Posted on 2013-12-12
6
510 Views
Last Modified: 2013-12-16
I prob sounds stupid for this questions... but I can't figure it out.

I want an option box (with option buttons) that will store text I want it to. The "Option Wizard" only lets me save numeric values for the choices.

What am I doing wrong?
0
Comment
Question by:cansevin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 28

Expert Comment

by:omgang
ID: 39714590
Each Option button in the Option Group (Option Box) has a numeric data 'Value' associated with it.  In the After Update event for the Option Group you'd have code like

Private Sub grpMyOptionGroup_AfterUpdate()

    Select Case Me.grpMyOptionGroup
        Case 1    'this is the value assigned to the first Option Button
            strValue = "This is the String value I want to store"

        Case 2    'this is the value assigned to the second Option Button
            strValue = "This is the other string value I want to store"

    End Select

        'code here to save the select string value to the data table


End Sub


OM Gang
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 39714604
Another option would be to use a combo box rather than an option group.
0
 

Author Comment

by:cansevin
ID: 39714617
Is there a way to make the combo box to have options to click? Or does it always have to be the drop down text?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 39714740
a combo box is always dropdown, but you can define the size of a listbox and display as many "options" as you want in the list.  You can furthermore hide columns, so if you wanted to display State Names, but wanted to store state abbreviations, you could use a SQL query for the rowsource of the list:

SELECT StateCode, StateName FROM tblStates ORDER BY StateName

and then set the listbox properties:

BoundColumn: 1
ColumnCount:2
Column Widths: 0, 1.5

Then you would size the list vertically and horizontally at appropriate.  If you have a short list of options, you could set the listboxes RowSourceType to "Value List" and then in the RowSource, you would simply type:

RowSource: "Option 1"; "Option 2"; "Option 3"
0
 
LVL 37

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39716911
Option groups are best used for very small sets of options that are not likely to change since changing them requires changes to forms and possibly reports also.

Combos provide for infinite (OK, maybe not infinite) lists of options and do not need to change when you add new ones.

Listboxes are the middle ground.  They also provide "infinite" lists but since you size them to show a specific number, they may need to be changed if you add additional items to the list but as long as you enable the scroll bars, you don't really have to modify the form, the user can just scroll to his choice.

Option groups are limited to storing numeric values and I suggest you stick with that because in addition to the code already suggested, you would need code in the form's current event to take the text values from the table and convert them to numeric so the option group shows the current value.

In any case, whenever you have a list of more than a few items or if the list is subject to change, it should be maintained as a table.  Given that, for reporting, you would use a query that joins to the lookup table and selects the text value.  That way your report can show the descriptive value rather than the numeric ID value.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39718706
Draw a sketch showing the look required.
Give an example of what to expect when clicking an option.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question