?
Solved

Programmatically reset option groups selection in ms access 2007 VBA

Posted on 2013-11-21
3
Medium Priority
?
2,891 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 1332 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 668 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 1332 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

777 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