Opt group help again....

J

Jason S.

Thanks to Jeff Conrad for the initial help. I am reposting
this as its been several days since my last post an I was
afraid it would get lost in time. Anyway, My question was
origionally how to report data when one uses an Opt group.
Since it is stored as 1,2,3,etc it reports that way in
reports, instead of how it was origionally intended to be
used. In my case, Initial, Re-Evaluation, and Temporary
Placement. Anyway, here is Jeff's reply.
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)


I did that and it works great when you are origionally
selecting the boxes in the Opt group. However, when I
scroll through records it does not change with the data.
Is there a way to have it continually update itself when
there is a change of the form? I frequently look through
previouslly imputed data and would like it to reflect the
current screens data.
 
J

John Vinson

I did that and it works great when you are origionally
selecting the boxes in the Opt group. However, when I
scroll through records it does not change with the data.
Is there a way to have it continually update itself when
there is a change of the form?

Put the same code in the Form's Current event.

You might want to consider having a Listbox with the three values,
rather than an option group with code, just for simplicity.
 

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