Results 1 to 8 of 8

Thread: Combo Box Question

  1. #1
    Guest

    Unhappy

    Is it possible under certain conditions to adjust the list property with the combo box? What I am trying to say is that if the user clicks on a command button and then clicks on the combo box, only certain items on the list property will be shown.

    Thank You for any help.

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Unhappy

    I don't think there's anyway to 'hide' items within a combo box. One way around it would to have 2 combo boxes. One being your 'master' list, the other the restricted view. When the user clicks the button populate the second box with the relevant items and hide the 'master'.

    My humbliest apologies if I'm teaching gramps to suck eggs.
    Anakim

    It's a small world but I wouldn't like to paint it.

  3. #3
    Guest
    If you are populating the box from a table-based query, you could write an update query in the code for the command button.

    Assume that the following populates the box:

    Select yyy from xxx where left$(yyy,1) <> (some unique char)

    Then

    UPDATE xxx SET xxx.[yyy] = (some unique char) & [yyy]
    WHERE (((where condition));


    Now requery and you should have something like what you want.

    Good Luck
    DerFarm

  4. #4
    Guest
    I like Anakim's answer better than mine. I would take it one step further, tho, and hide the master, populating the slave as everything from the first. In that way you wouldn't need "exception" processing, and it would be easier to stack conditions.


    DerFarm

  5. #5
    New Member
    Join Date
    Sep 2000
    Posts
    9
    Originally posted by Mikey H.
    Is it possible under certain conditions to adjust the list property with the combo box? What I am trying to say is that if the user clicks on a command button and then clicks on the combo box, only certain items on the list property will be shown.

    Thank You for any help.
    Hi!

    1. Bild a query from the DB where you have the Item for the box with them you then fill the combobox

    Private Sub cboKlasse_Click(Area As Integer)

    'Combo-Box neu befüllen

    deHFL.cmdKlasseSelectKurs criteria

    Set cboKlasse.RowSource = deHFL
    cboKlasse.RowMember = "cmdKlasseSelectKurs"
    cboKlasse.ListField = "KlassenName"


    End Sub

  6. #6
    Guest
    Thanks Guys. I'll check out that Master / Slave thing. Would it be to much to ask for an example, being that I'm A newbie?

  7. #7
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101
    Private Sub cmdButton_Click()

    'assuming we're taking everything beginning with an "A"
    'from the master

    ' I'd go along with DerFarm and have the master always
    ' invisible (saves changing visibility at run-time)


    Dim iIndx As Integer

    'remove all existing items from the slave.
    cboSlave.Clear

    For iIndx = 0 To cboMaster.ListCount - 1
    If UCase(Left(cboMaster.List(iIndx), 1)) = "A" Then
    cboSlave.AddItem cboMaster.List(iIndx)
    End If
    Next

    End Sub

    Hope that helps you along the way.

    One thing I'd like to know though... is how can I get the above code to appear 'vb' like? Seen it on shed load of other replies around the site.
    Anakim

    It's a small world but I wouldn't like to paint it.

  8. #8
    Guest
    Thanks Anakim. I'll try it. I don't know how to make the code above look vb-like.

Posting Permissions

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



Click Here to Expand Forum to Full Width