Setting default value

  • Thread starter Thread starter cinnie
  • Start date Start date
C

cinnie

hi to all

I have an option group (ogpMode) that contains two radio buttons (A, having
option value 1, and B, having option value 2). The default value for the
option group is initially set at 1.

I'd like the option group's default value to be whatever I last changed it
to. If I pick B, for example, then I'd like B to be selected next time I use
the program.

Why doesn't this work in the option group's AfterUpdate event?

Me!opgMode.DefautValue = Me!opgMode

thanks
 
Cinnie,
You will need to store the value of the option group somewhere - perhaps in
a table.
If you stored the value on a hidden form, you could easily get the value to
use next time, until you close the database.
Each time the value of the option group changes from its previous value, use
its after update event to store the new value in the table.
Each time you open the form, retrieve the default value from the table and
set the default value for the option group.
Bound text boxes and some other controls do have a default value when you
open a form to an existing record.

Jeanette Cunningham
 
Cinnie,
You will need to store the value of the option group somewhere - perhaps in
a table.
If you stored the value on a hidden form, you could easily get the value to
use next time, until you close the database.
Each time the value of the option group changes from its previous value, use
its after update event to store the new value in the table.
Each time you open the form, retrieve the default value from the table and
set the default value for the option group.
Bound text boxes and some other controls do have a default value when you
open a form to an existing record.

Jeanette Cunningham

Code the optionGroup's AfterUpdate event:

Me.OptionGroupName.DefaultValue = Me.OptionGroupName

This will set the default value for new records to whatever the last
entered value was. It does NOT retain the new value once the database
is closed.
 
Back
Top