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.
 
Thanks Rick,

I already have a table for default values and will use it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top