Change default of option button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If the user clicks an option button, I want that setting to remain the
default the next time the user opens the form. I coded as follows but it does
not work. I can see that clicking changes the value in the properties screen,
and then I close the form. However, when I re-open the form, the default
reverts to the previously set default. Suggestion appreciated:

Private Sub optViewNewPatients_AfterUpdate()
optViewNewPatients.DefaultValue = optViewNewPatients.Value
End Sub
 
richardb said:
If the user clicks an option button, I want that setting to remain the
default the next time the user opens the form. I coded as follows but
it does not work. I can see that clicking changes the value in the
properties screen, and then I close the form. However, when I re-open
the form, the default reverts to the previously set default.
Suggestion appreciated:

Private Sub optViewNewPatients_AfterUpdate()
optViewNewPatients.DefaultValue = optViewNewPatients.Value
End Sub

Changes to form properties like this made in runtime only apply to the current
instance of the form. You are not actually changing the design permanently.
The only way to make them permanently is if the form is opened in design view.

You could store the default value in a table or custom database property and
then retrieve and apply it in the Open event of the form.
 
Back
Top