Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006

    Unanswered: Help with Frame with 2-Option Boxes

    I'm sorry for being such a novice with Access 97. I hope you can help.

    I was using Combo Boxes with two values, 1 and 2, where if the value = 1, another text box was enabled, and when the value = 2 the text box was disabled.
    In the back table, the field has either 1, 2, or null values.

    For the programming with the combo box I used the following Event Procedures:

    Currently I want to use a Frame with two Option Buttons, to replace the combo box, with values 1 and 2, but I'm not quite sure what Event Procedures to use, as they're completely different than the onec for Combo Boxes.

    I don't have a default value for the option boxes.
    I want the text box to either be enabled or disabled depending on the values in the table.
    Also, I want the textbox be enabled or disabled depending which option button is clicked by the user to make changes for the values in the table.

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    I think this addresses all your issues:

    1) In Design View of your table place a field with the Data Type of Number
    2) Place your Option Group on your form
    3) Select the Option Group by clicking on the frame (not the option group label!!!)
    4) Go to Properties and assign the Option Group's Control Source to the
    appropriate field in your table

    In this example the Option Group is named OptionFrame, the Option Buttons are OptionOn (Value = 1) and OptionOff (Value = 2). These two enable/disable the text box. The textbox being manipulated is YourTextBox. Add this code:

    Private Sub Form_Current()
    OptionFrame.DefaultValue = 0  'On new records neither button is selected
         If OptionFrame.Value = 1 Then 'On move to record EnablesYourTextBox
             YourTextBox.Enabled = True
         ElseIf OptionFrame = 2 Then  'On move to record Disables YourTextBox
             YourTextBox.Enabled = False
         End If
    End Sub
    Private Sub OptionOn_GotFocus()  'When box is checked enables YourTextBox
        YourTextBox.Enabled = True
    End Sub
    Private Sub OptionOff_GotFocus() 'When box is checked disables YourTextBox
        YourTextBox.Enabled = False
    End Sub
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Aug 2006
    Thank you so much MissingLing, I truly appreciate your help. I will certainly try your code on Monday.

    Thanks again.


  4. #4
    Join Date
    Aug 2006
    It surely worked beautifully.
    I greatly appreciate your help.

    co mppal

Posting Permissions

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