Options group...

  • Thread starter Thread starter Jason S
  • Start date Start date
J

Jason S

Ive got an option group button on my form page. It is set
to input the value into a table. The problem is that you
can only set a number as a value. When I do querries, it
reports that number, instead of what it means. How can
you set the querry to show the true value of what that
number means, ex. "Initial" instead of "1". I want this
to occure in reports and in other tables that are linked
to my querry.
Thanks for your support.
Jason
 
Well there are lots of ways to do this I'm sure, but here's just one.

1. Assume your option group on the form is called optMyGroup and the first value is 1.

2. Create an unbound text box on the form called txtSelectedValue.

3. Set the default value of the text box to the text you want that matches the first option in the
group.
So let's make it "Initial" for now. When the form opens that will be the text box's value.

4. Then add this code to the option group's AfterUpdate event:

Private Sub optMyGroup_AfterUpdate()
Select Case Me.optMyGroup
Case 1
Me.txtSelectedValue = "Initial"
Case 2
Me.txtSelectedValue = "Second Option"
Case 3
Me.txtSelectedValue = "Third Option"
.............etc
Case Else
Me.txtSelectedValue = "Initial"
End Select
End Sub

Adapt of course to your requirements.

5. Now set the visibility of the text box to False so it can't be seen.
When you make a selection in the option group the text you want to reference will be in the hidden
text box.

6. Now reference the text box instead of the option group on all your queries and reports.
(Make sure the form is open if running these)
 
Back
Top