Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Thanked 0 Times in 0 Posts

    option group default value (Access 2000)

    How can i change the default value of an option group through a code?

    I have an option group called office with 5 options. I want to change the
    number of the option through a code like that:

    Public function Foffice()
    DoCmd.OpenForm "FOrderInformation"
    Dim office As Control
    Set office = Forms![FOrderinformation]![office]
    office.DefaultValue = 1
    etc etc
    end function

    However it doesnt work, the option value is not changed.For example, if the
    option value was 5 it remains 5 and does not change into 1.Can i write a code doing
    this, instead of doing it manually?

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Crystal Beach, FL, Florida, USA
    Thanked 33 Times in 33 Posts

    Re: option group default value (Access 2000)

    What you wrote should work. What you actually see on the screen of the 2nd form will depend on what is displayed. That is, if you display a current record, changing the default value won't change the value on the screen. While in 2nd form, go into De###### to verify what DefaultValue is.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: option group default value (Access 2000)

    Do you want to change the default value or the value? As Mark said, the code you posted should work to change the default value. If you want to change the actual value, just use the syntax optiongroup=number.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts