I want to select more than 1 option from an option group

N

Naduvatahni

I want to add one option group in a form of MS Access (2003) database
In this option group there are 5 or more options or choices available
As per group option wizard only 1 choice can be selected.
But I want to select 1 or more (eg.2 , 3 or 4 etc.) choices
Please advise me if it is possible by otion group or in any other way.
 
D

DStegon via AccessMonster.com

Create your own option group block with unbound check box controls. Then on
an event on the form you can test each of the controls for true (checked) or
false (unchecked) conditions and program accordingly. Just place the
required amount of check boxes on the form, give them approriate name for
ease in coding and then put a box around them (to give the appearance of an
option group) and then "group" them together so you can easily move them all
together.
 
A

Allen Browne

If one record could have multiple options associated with it, the best
solution is to use a related table.

We often see people attempting to use lots of check boxes to store the
various options. Here's an explanation of how to set up a related table
instead:
Don't use Yes/No fields to store preferences
at:
http://allenbrowne.com/casu-23.html
Although you asked about an option group rather than check boxes, the
solution is the same.

And here's another example of resolving that kind of data with a related
table:
Relationships between Tables (School Grades example)
at:
http://allenbrowne.com/casu-06.html
 
J

Jeanette Cunningham

Hi Naduvatahni,
a list box in multi select mode allows several choices.
Use the property dialog, the Other tab for the listbox to set its multi
select mode.

Here is some code-->

Public Function MultiSelectSQL(ctl As Control, _
Optional Delimiter As String) As String
Dim sResult As String
Dim vItem As Variant

With ctl
Select Case .ItemsSelected.Count
Case 0: sResult = " Is Null "
Case 1:
sResult = " = " & Delimiter & .ItemData(.ItemsSelected(0)) & Delimiter
Case Else
sResult = " in ("
For Each vItem In .ItemsSelected
sResult = sResult & Delimiter & .ItemData(vItem) & Delimiter & ","
Next vItem
Mid(sResult, Len(sResult), 1) = ")"
End Select
End With

MultiSelectSQL = sResult
End Function


Just paste the code above into a standard module.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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