option group

mdelo

Registered User.
Local time
Today, 08:08
Joined
Jun 19, 2001
Messages
15
I can't seem to figure out how to write code to change the numeric values assigned to option buttons in an option group to a text value to be placed in a table. The numeric values have no value to the user, they need to see text values.
 
Seems to me that:

You have some option buttons on a form and when selected you want the selected value caption value to be automatically inserted into a textbox on the same form?

If I'm right on that then I have these questions and suggestions...

Are your option buttons in a frame?

If not they should be, if the option buttons are unbound then you should be able to jsut delete them, then use the frame/option group wizard on the tools menu to rebuild the options in a frame.

The reason they should be is because it is the frame that holds the integer value of the selected item. Your first item will return 1 to the frame, second one 2 etc..

In the AfterUpdate event you can then set the value to be passed into the text box dynamically.

Example Code:

Private Sub Frame3_AfterUpdate()
Dim strFiller As String
If Me.Frame3 = 1 Then
strFiller = "One"
ElseIf Me.Frame3 = 2 Then
strFiller = "Two"
ElseIf Me.Frame3 = 3 Then
strFiller = "Three"
End If
Me.FillMe = strFiller
End Sub

FillMe is a text box on the form.

Ian
 
Storing the numeric value is the best way if you want to use it with an option group. For the times you want to display it as text use the Choose() function. It is succinct and can easily be used in a query or as a controlsource on a form or report.
 

Users who are viewing this thread

Back
Top Bottom