OptionValue default value

  • Thread starter Thread starter Vsn
  • Start date Start date
V

Vsn

Hello all,

Who can tell me what the correct way is to set the default 'optionvalue'
when a form opens, I have now done it as below:-

Private Sub Color_Option_Click()
Me.Detail.BackColor = Me.Controls("Color_Option").Value
End Sub

Private Sub Form_Load()
Me.Controls("Standard").OptionValue = -2147483633
Me.Controls("Green").OptionValue = 65280
Me.Controls("Blue").OptionValue = 16711680
Me.Controls("Red").OptionValue = 255
Me.Controls("Yellow").OptionValue = 65535
Me.Color_Option.DefaultValue = -2147483633
'To be sure form starts with default value
Color_Option_Click
End Sub

Thx,
Ludovic
 
Set the Value of the option group to the OptionValue of the first option
button.

Assuming the buttons have attached labels, it's probably something like
this:

With Me.[NameOfYourOptionGroupHere]
.Value = .Controls(1).OptionValue
End With
 
That looks much better as my solution.

Thx,
Ludovic

Allen Browne said:
Set the Value of the option group to the OptionValue of the first option
button.

Assuming the buttons have attached labels, it's probably something like
this:

With Me.[NameOfYourOptionGroupHere]
.Value = .Controls(1).OptionValue
End With

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Vsn said:
Hello all,

Who can tell me what the correct way is to set the default 'optionvalue'
when a form opens, I have now done it as below:-

Private Sub Color_Option_Click()
Me.Detail.BackColor = Me.Controls("Color_Option").Value
End Sub

Private Sub Form_Load()
Me.Controls("Standard").OptionValue = -2147483633
Me.Controls("Green").OptionValue = 65280
Me.Controls("Blue").OptionValue = 16711680
Me.Controls("Red").OptionValue = 255
Me.Controls("Yellow").OptionValue = 65535
Me.Color_Option.DefaultValue = -2147483633
'To be sure form starts with default value
Color_Option_Click
End Sub

Thx,
Ludovic
 
Back
Top