Avatar of SteveL13
SteveL13
Flag 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.
Microsoft Access

Avatar of undefined
Last Comment
Rey Obrero (Capricorn1)

8/22/2022 - Mon
Rey Obrero (Capricorn1)

use the afterupdate event of the option group

private sub optiongroupname_afterupdate()

me.textboxname=me.optiongroupname

end sub
Rey Obrero (Capricorn1)

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
Helen Feddema

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Helen Feddema

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
Rey Obrero (Capricorn1)

@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



...
SteveL13

ASKER
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?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.