Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've searched this forum and other newsgroups before asking here. I have several radio buttons on a form. If user clicks one of them, a single drop down list shows items specific to that button. Each button has its own list of items. Would someone please show how to code this based on this simple example.

    Radio button1 = Dogs
    Radio button2 = Cats
    Radio button3 = Fish

    Array1 = .AddItem "Dauchund"
    .AddItem "Great Dane"

    Array2 = .AddItem "Persian"
    .AddItem "Tabby"

    Array3 = .AddItem "Catfish"
    .AddItem "Bass"

    I'm not sure how all of this is built.

    Thank you,
    Charlie
    charlie6067

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You could use code like this (with the appropriate names substituted):

    Code:
    Private Sub optCats_Click()
      With Me.lstSpecies
    	.Clear
    	.AddItem "Persian"
    	.AddItem "Siamese"
    	.AddItem "Tabby"
      End With
    End Sub
    
    Private Sub optDogs_Click()
      With Me.lstSpecies
    	.Clear
    	.AddItem "Alsatian"
    	.AddItem "Border Collie"
    	.AddItem "Dobermann"
      End With
    End Sub
    
    Private Sub optFish_Click()
      With Me.lstSpecies
    	.Clear
    	.AddItem "Cod"
    	.AddItem "Goldfish"
    	.AddItem "Shark"
      End With
    End Sub
    See attached sample doc. [attachment=83841:OptionDemo.doc]
    Attached Files Attached Files

  3. #3
    Star Lounger
    Join Date
    May 2009
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='775771' date='18-May-2009 14:49']You could use code like this (with the appropriate names substituted):

    Code:
    Private Sub optCats_Click()
      With Me.lstSpecies
    	.Clear
    	.AddItem "Persian"
    	.AddItem "Siamese"
    	.AddItem "Tabby"
      End With
    End Sub
    
    Private Sub optDogs_Click()
      With Me.lstSpecies
    	.Clear
    	.AddItem "Alsatian"
    	.AddItem "Border Collie"
    	.AddItem "Dobermann"
      End With
    End Sub
    
    Private Sub optFish_Click()
      With Me.lstSpecies
    	.Clear
    	.AddItem "Cod"
    	.AddItem "Goldfish"
    	.AddItem "Shark"
      End With
    End Sub
    See attached sample doc. [attachment=83841:OptionDemo.doc][/quote]

    Thank you Hans for the quick reply. This is exactly what I need to get started. Have a good day!
    Charlie
    charlie6067

Posting Permissions

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