Solved

Programmatically reset option groups selection in ms access 2007 VBA

Posted on 2013-11-21
3
2,791 Views
Last Modified: 2013-11-21
I have 3 option groups with 3 radio buttons each group. The default (selected) radio button in each group is the #1 (First button). I would like to create a button that will reset all the option selections to option #1 in each group
I have tried:
Me.MyOptionGroup1 = 1
Me.MyOptionGroup1.Value = 1
But nothing seems to work
0
Comment
Question by:Cobra967
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 333 total points
ID: 39666040
this should work

Me.MyOptionGroup1.Value = 1

are you sure that the name of the option group is "MyOptionGroup1"
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 167 total points
ID: 39666056
I think both statments should work, assuming three things:

1.  That OptionGroup1 is the name of the correct control... the name of the *frame* that encloses the options

2.  That you haven't modified the 'values' of the options that are set by default when you create an option group.

3.  That your event procedure for the button is actually running.  Make sure that code/macros are enabled and double check that 'Event procedure' is showing up in the command buttons property sheet next to  On Click.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 333 total points
ID: 39666061
better use vba codes to that

private sub btnReset_click()
Dim ctl As Control
For Each ctl In Me.Controls
     If ctl.ControlType = acOptionGroup Then
          ctl.Value = 1
     End If

Next
end sub
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question