Link to home
Start Free TrialLog in
Avatar of smods
smods

asked on

Option Buttons - None numeric value?

Hi there,

I have a set of option buttons on my form which I want to capture certain details.  Having used infopath before which captures whatever value you like, I was surprised to see access will only let me capture a numeric value.  Is there any way around this?

Regards

Chris
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

to capture a letter "A", set the value of the option button to 65 and use

chr(optiongroup.value)
<<Is there any way around this?>>

  Not sure I understand; based on the option selected, you can store anything based on that value by using the groups AfterUpdate event.

JimD.
Avatar of smods
smods

ASKER

Sorry for not being clear.  I wish to capture specific reasons such as "Incorrect process followed" etc but access only seems to allow me to store a numeric value.

Regards

Chris
you can assign those String values to the values in an option group

dim strText as string
select case optiongroup

 case 1:strText="Incorrect process followed"
     

 case 2:strText="Correct process followed"


etc..

end select
Chris,

How about make your option group unbound. Then, use VBA as a way around to capture the text value of your field.

E.g.

If Me.fraOption = 1 Then
Me.YourField="A"
Else
Me.YourField="B"
End If

Sincerely,
Ed
Or use choose:

   =Choose(Me.<groupcontrolname>, "Text option 1", "Text option 2", "Text option 3")

JimD.
Avatar of smods

ASKER

Cheers capricorn1

Where do I enter these?
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smods

ASKER

Thanks,

Is this supposed to automatically update the values in the table?  They're still showing as 1, 2, 3 etc in the table.
you have to unbound the Option Group and save records by using vba codes
<<Is this supposed to automatically update the values in the table?  They're still showing as 1, 2, 3 etc in the table. >>

  That would be correct.  If you want the strings stored, you'd use and unbound option group, then set a bound, hidden text control with the string you want stored in the afterupdate event.

  However, that is not the norm.  Usually you store only the value.

JimD.
Avatar of smods

ASKER

Sorry I don't understand.

The option group is now unbound and I entered the code you have provided.  What code do I need to enter in order to get the data to save?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smods

ASKER

Cheers Jim,

I used capricorns code but it's not capturing the values in the table!
<I used capricorns code but it's not capturing the values in the table!>

does not mean anything, if you will not post the codes you used...
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smods

ASKER

Cheers for that JVWC.

That's working now! I can see where I had gone wrong.  Once I add a record now on my form it is capturing the text, however the last option button selected still remains automatically selected?
In my example I showed both the bound field and an unbound field that is set by the afterupdate code.
The option box  will always refflect the value in the bound field.

If you only need the text then remove the contol source from the option box in form design view.

Cheers
JC
smods
Please note JDettmans comment above 34888480.

It is far more efficient to store only the the value and the process that into text as you require..

Cheers
JC
Avatar of smods

ASKER

Thanks all.