Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2005
    Posts
    220

    Unanswered: Option Group Question

    I have a series of unbound controls on a form. One "grouping" of fields has 10 parameters. I want users to be able to select one, and only one of those fields to update.

    Here's the question. Am I better off doing this with an option group, or is there a better way?

    My first whack at this had me creating 10 individual text boxes and then jumping through hoops trying to grey out and lock the non-selected options and the corresponding text boxes. This gets to be a pain. My other thought was to create an option group and then have a single text box for the field entry, but one of the fields involve a multiselect listbox.

    Any advice would be greatly appreciated.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Well ... You can't option group textboxes (or for that matter combos or list boxes either) ... looks like you'll have to do your disable hoop jumping ... The easiest way is to trap on either the Change event or the Afterupdate event and in the method chosen set a token flag (for which control used) and call a common routine to disable the rest of the controls - basically a series of if.. thens not matching to the token that remains enabled. Oh, you'll also want a reset button to reenable everything is the user changes their mind ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Sep 2005
    Posts
    220
    Thanks for the reply. This is the hoop jumping I'm referring to, but I don't think I follow what you are recommending.

    Code:
    Private Sub DaysOfSupplyOption_Click()
    
        PromoCodeOption.Enabled = False
        StockClass1Option.Enabled = False
        DistribChannel1Option.Enabled = False
        DlrSuppCodeOption.Enabled = False
        AltDlrSuppCodeOption.Enabled = False
        MinNameOption.Enabled = False
        
    End Sub
    
    Private Sub PromoCodeOption_Click()
    
        DaysOfSupplyOption.Enabled = False
        StockClass1Option.Enabled = False
        DistribChannel1Option.Enabled = False
        DlrSuppCodeOption.Enabled = False
        AltDlrSuppCodeOption.Enabled = False
        MinNameOption.Enabled = False
        
    End Sub
    
    Private Sub StockClass1Option_Click()
    
        DaysOfSupplyOption.Enabled = False
        PromoCodeOption.Enabled = False
        DistribChannel1Option.Enabled = False
        DlrSuppCodeOption.Enabled = False
        AltDlrSuppCodeOption.Enabled = False
        MinNameOption.Enabled = False
        
    End Sub

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by ssmith001
    Thanks for the reply. This is the hoop jumping I'm referring to, but I don't think I follow what you are recommending.

    Code:
    Private Sub DaysOfSupplyOption_Click()
    
        PromoCodeOption.Enabled = False
        StockClass1Option.Enabled = False
        DistribChannel1Option.Enabled = False
        DlrSuppCodeOption.Enabled = False
        AltDlrSuppCodeOption.Enabled = False
        MinNameOption.Enabled = False
        
    End Sub
    
    Private Sub PromoCodeOption_Click()
    
        DaysOfSupplyOption.Enabled = False
        StockClass1Option.Enabled = False
        DistribChannel1Option.Enabled = False
        DlrSuppCodeOption.Enabled = False
        AltDlrSuppCodeOption.Enabled = False
        MinNameOption.Enabled = False
        
    End Sub
    
    Private Sub StockClass1Option_Click()
    
        DaysOfSupplyOption.Enabled = False
        PromoCodeOption.Enabled = False
        DistribChannel1Option.Enabled = False
        DlrSuppCodeOption.Enabled = False
        AltDlrSuppCodeOption.Enabled = False
        MinNameOption.Enabled = False
        
    End Sub
    Yeee GODS! Here's what I'm talking about:

    ' {Form Level}

    Dim OptionSelected As Integer

    Private SetFakeOptionGroup()
    if OptionSelected=1 then
    Test1.Enabled=False
    SomeButton1.Enabled=False
    ...
    Endif

    If optionSelected=2 then
    Test2.Enabled=False
    Somebutton2.Enabled=false
    ...
    Endif

    End Function

    Private Sub PromoCodeOption_Click()

    OptionSelected=6
    SetFakeOptionGroup
    End Sub


    NOW, do you get the idea???
    You might be able to optimize this using control arrays where you skip the selected control ... All that is required is a sequential naming scheme.
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    Why is the list box an issue using an option group to select the name of the field you want to update?

Posting Permissions

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