combo box

I am new to foxpro and have a few questions so i will post them seperatly.

I have a form that is filled out and stored in a free table.  i have 4 fields on the form.  for the purpose of explaining clearly field one is a combo box, 2 is a combo box, 3 is a combo box, and 4 is a text box.  the first 2 combo boxes are getting info from one table with 3 fields.  Field one is park,  field 2 is tower and field 3 is group.  Each park has multiple towers.  What i need to do is select a park from the combo box in field one on the form and then have it filter combo box 2 (tower) so that only the towers in the selected park are available.

Once i have selected my park and tower i need combo box 3 which is a code to be populated by one of 2 tables depending on the code group in the table used in the first step above.  I have 2 seperate tables of codes (group1 and group2) once i select a code it puts the code discription in the textbox.  I hope that i made myself clear.  Its kind of hard to explain.  I am able to populate all the combo boxs now but not able to do what i have explained above.  Also now when i select a code in a combo box i need to click the textbox for the discription to appear

Any help would be great.  Thanks



Answer this question

combo box

  • Matt Thubron

    I will try this. Basically combo box 2 is populated depending on what is selected in combo 1 and combo 3 depends upon what is selected in combo 1 and text box is populated by what is selected in combo 3.  That might make more sence.

     

    Thanks for the help


  • Mark 5762

    A strange design. Anyway use RowSourceType=3 && SQL. ie:

    * Form.init
    with this.cmbParks
      .RowSourceType = 3
      .RowSource = "select park, group from parksTable into cursor crsParks"
      .ColumnCount = 1
    endwith

    with this.cmbTowers
      .RowSourceType = 3
      .RowSource = "select tower, park,group from parksTable"+;
               "  where park == crsParks.Park "+;
               "  into cursor crsTowers"
     .ColumnCount =1
    endwith

    with this.cmbGroup
      .RowSourceType = 3
      .RowSource = "select * from (crsTowers.Group) into cursor crsGroup"
     endwith
    this.txtDescription.ControlSource = "crsGroup.Description"

    * cmbParks.InteractiveChange && might be valid,lostfocus or 2nd combo's gotfocus
    with this.parent.cmbTowers
     .ListIndex = 0
     .Requery()
    endwith

    * cmbTowers.InteractiveChange
    with this.parent.cmbGroup
     .ListIndex = 0
     .Requery()
    endwith

    * cmbGroup.InteractiveChange
    this.Parent.txtDescription.Refresh

    Code needs some tweak based on your needs but this general skeleton.


  • combo box