Results 1 to 7 of 7
  1. #1
    sainttomn's Avatar
    sainttomn is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Location
    2 Gangster Planets and a Cowboy World
    Posts
    12

    Option Group Radio Button Default is Null on Table

    Hello all, I have a question that I assume has a relatively simple fix.



    I have a form and an Option Group field called ZeroOption with 2 radio buttons, labelled Yes(=1) and No(=2).

    When I open the form, submit the record, or clear the form, the Option Group resets to No (which is also the default in Properties), using the following code:

    Code:
    Me.ZeroOption = "2"
    Visually, this works great, and the "No" radio button defaults as intended. The table this writes too, however, results in a blank field. If the user clicks the "No" option, this will sumit to the table properly. It seems like my code is missing something.

    Any healp is greatly appreciated.

    -Tomn

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you tried: Me.ZeroOption = 2 ??? It is probably a numeric field.

  3. #3
    sainttomn's Avatar
    sainttomn is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Location
    2 Gangster Planets and a Cowboy World
    Posts
    12
    I just changed the code to Me.ZeroOption = 2 and got the same result.

    The field on the table that this submits to is a Text Field. Perhaps I missed something in my earlier post as well. I use the code below to do a few things as well. Basically, besides changing the BackColor and BackStyle of a few labels this should set the Automatic Zero field (also on form and table -Text Field) to read Yes or No respectively.

    Code:
    Private Sub ZeroOption_AfterUpdate()
    Select Case ZeroOption.Value
    Case 1
    [Automatic Zero].Value = "Yes"
    Label276.BackStyle = 1
    Label276.BackColor = 3937500
    Label278.BackStyle = 0
    Case 2
    [Automatic Zero].Value = "No"
    Label276.BackStyle = 0
    Label278.BackStyle = 1
    Label278.BackColor = 3329330
    End Select
    End Sub
    When I click the radio button this works flawlessly, but the default code from my first post doesn't seem to select the radio button as much as rest the default there.

    Thank you for your help,
    -Tomn

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Would just setting the default value in the table work for you?

  5. #5
    sainttomn's Avatar
    sainttomn is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Location
    2 Gangster Planets and a Cowboy World
    Posts
    12
    It absolutely would. Occam's Razor wins again.

    Thank you very much for your assistance.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I love those simple solutions!

  7. #7
    sainttomn's Avatar
    sainttomn is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Location
    2 Gangster Planets and a Cowboy World
    Posts
    12
    Agreed! Thanks again.

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

Similar Threads

  1. Replies: 5
    Last Post: 05-17-2011, 11:02 AM
  2. option group default values
    By wlumpkin in forum Access
    Replies: 3
    Last Post: 02-15-2011, 03:30 PM
  3. option group default values
    By wlumpkin in forum Access
    Replies: 6
    Last Post: 02-07-2011, 06:07 PM
  4. Replies: 3
    Last Post: 11-02-2010, 10:15 AM
  5. option group radio buttons
    By ManC in forum Forms
    Replies: 9
    Last Post: 03-08-2010, 03:46 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