populate textbox from two combo boxes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Higgs
    New Member
    • Mar 2011
    • 12

    populate textbox from two combo boxes

    Hello,

    If i have a table like this:

    U I AbsTime TypeOfFile
    2 0.01 0000001 000001-D00
    3 0.01 0000002 000001-D00
    4 0.01 0000003 000002-D00
    7 0.02 0000004 000003-D00
    5 0.03 0000005 000001-D04
    6 0.01 0000006 000002-D04

    And i have made two combo boxes (on a form) where you can select one of the fields; either U,I,AbsTIme or TypeOfFile. And the other combo box where i have added the parameters D00,D01,D02,D03 ,D04.

    How do i populate a listbox based on the selections from the two combo boxes?

    i.e if i choose combo1 = U and combo2 = D00 i want the textbox to be populated with:

    000001-D00
    000002-D00
    000003-D00

    Where 000001-D00 corresponds to U = 2 and 3; and 000002-D00 corresponds to U = 4; and 000003-D00 corresponds to U=7.

    Thanks a lot



    ----==== Edit =====----

    i have tried something like:

    Code:
    Private Sub Combo2_AfterUpdate()
       Me!List12 = Me!Combo2.Column(0)
    End Sub
    just to try to see how it works. I thought that this code would populate the textbox after selecting a parameter from the combo2. But unfortunatly it doesnt. Guess im missing out on something here.

    Cheers
    Last edited by Higgs; Apr 4 '11, 10:29 AM. Reason: Typo; should be listbox insteaad of textbox
  • Scorp Scorp
    New Member
    • Mar 2011
    • 40

    #2
    You need to populate in a textbox or a listbox ??

    To triger the combo selection, u should use on change event:
    Code:
    Private Sub Combo24_Click()
    me.text12.value = me.combo24.text
    End Sub

    Comment

    • Higgs
      New Member
      • Mar 2011
      • 12

      #3
      sorry my mistake, it should be listbox and not textbox.

      Thanks

      Comment

      • Scorp Scorp
        New Member
        • Mar 2011
        • 40

        #4
        Set you list Data Row source property to Value List.
        Code:
        Private Sub Combo24_Click() 
        me.list12.additem me.combo24.text 
        End Sub

        Comment

        • Higgs
          New Member
          • Mar 2011
          • 12

          #5
          Thank you,

          Thats a good start. As i have progressed and need to ask a new question ill start a new thread to avoid any confusions.

          Thanks

          Comment

          Working...