>I have a grid where 2 of the columns contain comboboxes. The first column contains a single "type" combo, which has 3 hardcoded choices. The 2nd column contains 3 different combos that match the selected type of the first column. I was hoping to use a DynamicCurrentControl command to set the correct combo based on the value in the first column, but no joy. The form's activate method does correctly set the dynamiccurrentcontrol for a different column (which shows a commandbutton), but i'm missing something w/ the other column that has 3 combos in it. It doesnt error out, but i am not getting the result i expected.
>
>Form's ACTIVATE method...
>
>
>SELECT tmpfloor
>WITH thisform.grdfloor
> .column23.sparse = .f.
> .column23.dynamiccurrentControl = 'IIF( EMPTY(tmpfloor.fn_comment),"CmdBlack","CmdBlue" )'
> .Scrollbars = 3
>ENDWITH
>
>SELECT tmpfloor
>WITH thisform.grdfloor
> .column4.sparse = .f.
> .column4.dynamiccurrentControl = 'IIF( tmpfloor.fn_finish = "FLOOR";
> OR EMPTY(tmpfloor.fn_finish),"ComboFloor", ;
> IIF(tmpfloor.fn_finish = "CEILING","ComboCeiling","ComboWall" )) '
> .scrollbars = 3
>ENDWITH
>
>
>In the form's INIT, a method is called that sets up the grid properties...
>
>
> .column4.controlsource = "tmpfloor.fn_type"
> .column4.ComboCeiling.ColumnCount = 1
> .column4.ComboCeiling.ColumnWidths = "120"
> .column4.ComboCeiling.ColumnLines = .t.
> .column4.ComboCeiling.DisplayCount = 6
> .column4.ComboCeiling.rowsourcetype = 3
> .column4.ComboCeiling.rowsource = "SELECT floortype FROM floor ;
> ORDER BY floortype INTO CURSOR _cfloorC ;
> WHERE UPPER(floor.floorfin)='CEILING'"
>
> .column4.ComboFloor.ColumnCount = 1
> .column4.ComboFloor.ColumnWidths = "120"
> .column4.ComboFloor.ColumnLines = .t.
> .column4.ComboFloor.DisplayCount = 6
> .column4.ComboFloor.rowsourcetype = 3
> .column4.ComboFloor.rowsource = "SELECT floortype FROM floor ;
> ORDER BY floortype INTO CURSOR _cfloorR ;
> WHERE UPPER(floor.floorfin)='FLOOR'"
> .column4.currentcontrol = "ComboFloor"
>
> .column4.ComboWall.ColumnCount = 1
> .column4.ComboWall.ColumnWidths = "120"
> .column4.ComboWall.ColumnLines = .t.
> .column4.ComboWall.DisplayCount = 6
> .column4.ComboWall.rowsourcetype = 3
> .column4.ComboWall.rowsource = "SELECT floortype FROM floor ;
> ORDER BY floortype INTO CURSOR _cfloorW ;
> WHERE UPPER(floor.floorfin)='WALL'"
>
>
>
>When the form displays, regardless of the value in the "type" combo (1st column), the "currentcontrol" combo in the 2nd column is not predicated on the field referenced in the "dynamicacurrentcontrol" command used in the form's activate. Wondering if i should bail on the SQL statements as the row source and go w/ cursors.
Chris,
1) I couldn't see where tmpFloor is changing. It's constant, no? (maybe in hidden 1st column).
2) Add parentheses around the whole expression (ie: "(iif(...))" )
3) Also as I could see it you don't need 3 combos there. One combo would do, no?
... WHERE UPPER(floor.floorfin)= iif(empty(tmpfloor.fn_finish),'FLOOR', tmpfloor.fn_finish)"
Cetin