Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

How refresh form data when click an option button

I have an option group on a form.  I also have a field which displays the value of the selected button.  But how do I refresh the value field when I select a different button?  I want to see it right away, not when I close and re-open the form.
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

use the afterupdate event of the option group

private sub optiongroupname_afterupdate()

me.textboxname=me.optiongroupname

end sub
if you want display the text part of the option group

private sub optiongroupname_afterupdate()

me.textboxname=choose(me.optiongroupname,"AAA","BBB","CCC")

end sub
SOLUTION
Avatar of Helen Feddema
Helen Feddema
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 SteveL13

ASKER

I know this is probably a dumb question but how do I know what the name of the option group is?  I created it and don't remember having to name it.  So I created it again and it never does ask me the name of it.
Access will have given it a default name such as Frame12, which is meaningless.  Select the option group in Design view, and give it a meaningful name, such as fraColors.  In fact, it is a good idea to give all controls meaningful names with appropriate prefixes.  This will avoid possible reference errors when a control has the same name as its bound field, and make your code much more readable.  I have an add-in that semi-automates renaming objects and controls according the Leszynski Naming Convention.  You can download the appropriate version (free) from the Code Samples page of my Website:
http://www.helenfeddema.com/CodeSamples.htm
@SteveL13

in the design view of the form,

select the option group, then hit F4
select the Other tab and look for the value listed in the NAME property



...
When I select the whole group, all the radio buttone, frame, etc.) "Name" doesn't show up in Other.  Do you mean the name of one radio button?
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