Solved

Programmatically reset option groups selection in ms access 2007 VBA

Posted on 2013-11-21
3
2,606 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
  • 2
3 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 333 total points
Comment Utility
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
Comment Utility
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 119

Accepted Solution

by:
Rey Obrero earned 333 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now