Results 1 to 5 of 5
  1. #1
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100

    Resetting Option Group Values

    I have a set of options groups I want "reset" to my chosen default values. I placed a command button on the form with the following On Click event code:



    Code:
     
    Private Sub btnDefaultNoneOn_Click()
    On Error GoTo Err_btnDefaultNoneOn_Click
     
        Me.og3 = 2
        Me.og4 = 2
        Me.og5 = 2
        Me.og6 = 2
        Me.og7 = 1
        Me.og8 = 1
        Me.og9 = 1
     
    Exit_btnDefaultNoneOn_Click:
        Exit Sub
     
    Err_btnDefaultNoneOn_Click:
        MsgBox Err.Description
        Resume Exit_btnDefaultNoneOn_Click
     
    End Sub
    Where the option groups are named og3, og4, etc.

    When I run the form, I get an "Object doesn't support this property or method" error.

    Might someone offer a suggestion regarding an object supported property or method to reset my ogs to my default values?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    have you tried putting '.value' after the 'og3'?? etc..

    and what are they values associated with the group items?? important to remember that options groups have "values" associated with them, but they also have integers associated with each of those ''values'', which are always stored in the tables.

  3. #3
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Adding ".Value" after the og3 etc generated a compile error: Method or data member not found.

    Based on your question, I believe I am wanting to reset the integer associated with each button on each og. For instance, if the user selects the third radio button for og3 and the og3 default is the second radio button, my intent is to have the command button reset og3 to the default second radio button.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    I understand that. go to the prop sheet for the option groups and see what actual 'values' are. they should listed on one of the prop tabs.

    then try to assign that string value, or number value, whatever you chose initially, to the control instead of the actual integer alias that Access mandates for those types of controls.

  5. #5
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    After some experimenting, this is what worked:

    Code:
     
    Private Sub btnDefaultNoneOn_Click()
    On Error GoTo Err_btnDefaultNoneOn_Click
     
        Me.og3.Value = Me.og3.DefaultValue
        Me.og4.Value = Me.og4.DefaultValue
        Me.og5.Value = Me.og5.DefaultValue
        Me.og6.Value = Me.og6.DefaultValue
        Me.og7.Value = Me.og7.DefaultValue
        Me.og8.Value = Me.og8.DefaultValue
        Me.og9.Value = Me.og9.DefaultValue
     
    Exit_btnDefaultNoneOn_Click:
        Exit Sub
     
    Err_btnDefaultNoneOn_Click:
        MsgBox Err.Description
        Resume Exit_btnDefaultNoneOn_Click
     
    End Sub
    Using your ".Value" suggestion and enclosing the number in quotes also works.

    Code:
    Me.og3.Value = "2"
    Thanks for your input!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. option group default values
    By wlumpkin in forum Access
    Replies: 3
    Last Post: 02-15-2011, 03:30 PM
  2. option group default values
    By wlumpkin in forum Access
    Replies: 6
    Last Post: 02-07-2011, 06:07 PM
  3. Combo Box and Option Group Values
    By Desstro in forum Queries
    Replies: 8
    Last Post: 09-06-2010, 11:40 PM
  4. Option Group
    By huskies in forum Forms
    Replies: 9
    Last Post: 12-02-2009, 12:06 PM
  5. Option Group broken out
    By dcecil in forum Reports
    Replies: 3
    Last Post: 04-21-2009, 10:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums