Option group Default

  • Thread starter Thread starter Secret Squirrel
  • Start date Start date
S

Secret Squirrel

I have an option group on my form with 4 options. When I open the form how
can I set the first option as the default? I need to load this default when
the form opens.
 
The OptionGroup object has a DefaultValue property. Set its value to the
OptionValue value of the option button in question.
 
On the forms on open event

Private Sub Form_Open(Cancel As Integer)
Me.OptionGroupName.DefaultValue = 1 'Default value 1 to 4, 1 selected
End Sub

Does this help?????

Kindest regards
Mike B
 
Hi Doug,
I did that but if another option is selected then when I close the form and
reopen it that same option is still selected. I need it to revert back to
option 1 when the form is opened. I thought that just setting the
DefaultValue property to 1 would do the trick but for some reason it's not.
 
I also agree with douglas, the default is set normally in the option group
properties, there is no real need to overide it as its applied as the form is
opened.

Default 1

Regards
 
If it is a bound control then of course it would retain its value. If it is
truly unbound, setting the default should work when reopening after closing.
If the default value still won't work if it is an unbound control then use
the code version in the form's on load event.

--

Thanks,

Bob Larson
Access MVP

Free Access Tutorials and Resources: http://www.btabdevelopment.com
 
Back
Top