[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3017
  • Last Modified:

Programmatically reset option groups selection in ms access 2007 VBA

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
Cobra967
Asked:
Cobra967
  • 2
3 Solutions
 
Rey Obrero (Capricorn1)Commented:
this should work

Me.MyOptionGroup1.Value = 1

are you sure that the name of the option group is "MyOptionGroup1"
0
 
mbizupCommented:
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
 
Rey Obrero (Capricorn1)Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now