Setting option button as default on form load

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

Guest

I'm trying to set an option button to always be the default even when I run
my database when coming out of design view. Ive tried doing this in the load
event:

option23.Value = true

I receive a run-time error:

Run-time error '2448'

You can't assign a value to this object.

*The object may be a control on a read-only form.
*The object may be on a form that is open in Design view.
*The value may be too large for this field.

I went through the group option wizard and did set the correct option but to
be default. It seems if i leave the other option button selected when I go
into design mode and re-run my application, the last selected option button
is still selected. How can I change it so Option23 is selected by default
whenever the application is run. Thank you in advance.

-Adam
 
When you choose an option from the option group, you're actually assigning a
value to the group and not the option button itself. So, if option group is
called grpChoices and Option20=1, Option21=2, Option22=3 and Option23=4,
then try: grpChoices=4 when your form loads to "select" Option23 as the
default.
 
Thank you very much, this solved my problem! I was just approaching it the
wrong way and never thought that the Group itself had a value.

-Adam
 
Adam,
There is one other thing to watch for here. If you open a form, change
values in the form (for example, Option Group default value is 23), go into
design mode, then return to form view, the values that were in the form
before you went to design mode will still be there. To test something like
this, the easiest way is to make your changes in design mode, save the form,
close the form, and open it again. That way you will always get the default
values and know if they are correct.
 
Back
Top