>In a Form I have 3 combos cboLoteamento, cboQuadra, cboLote where cboQuadra depends on a value selected in cboLoteamento and cboLote depends on value selected on cboQuadra.
>cboLoteamento->cboQuadra->cboLote
>
>The "properties" of combo1 are(cboLoteamento):
>cboLoteamento.BOUNDCOLUMN = 2
>cboLoteamento.ROWSOURCETYPE = 3
>cboLoteamento.ROWSOURCE = "SELECT nome, codigo FROM loteamentos ORDER BY nome ;
>INTO CURSOR cur_loteamentos"
>
>The "properties" of combo2 are(cboQuadra):
>cboQuadra.BOUNDCOLUMN = 2
>cboQuadra.ROWSOURCETYPE = 3
>cboQuadra.ROWSOURCE = "SELECT nome_num, codigo FROM quadras WHERE ;
>cod_loteamento = ?cCBO1_Value order by nome_num INTO CURSOR cur_quadras"
>
>The "properties" of combo3 are(cboLote):
>cboLote.BOUNDCOLUMN = 2
>cboLote.ROWSOURCETYPE = 3
>cboLote.ROWSOURCE = "SELECT numero, codigo FROM lotes WHERE ;
>lotes.STATUS stat_venda AND cod_quadra = ?cCBO2_Value ;
>order by numero INTO CURSOR cur_lotes
>
>In the InterActiveChange of Combo1:
>DODEFAULT()
>LOCAL cCBO1_Value, cbo1
>SET STEP ON
>cbo1 = THIS.VALUE
>WITH THISFORM.cboQuadra
> .REQUERY()
> .LISTINDEX = 0
>ENDWITH
>THISFORM.cCBO1_Value = THIS.DISPLAYVALUE(1)
>
>
>In the InterActiveChange of Combo2:
>DODEFAULT()
>LOCAL cCBO2_Value, cbo2
>cbo2 = THIS.VALUE
>WITH THISFORM.cboLote
> .REQUERY()
> .LISTINDEX = 0
>ENDWITH
>THISFORM.cCBO2_Value = THIS.DISPLAYVALUE(1)
>
>When I ADD new record and select the values of the combos and save it the combo shows the values added, but if I move the pointer with First, Next, Last, etc... the 2° and 3° combo doesnt show the values more, all other objects keep showing the right values.
>
>To move the pointer I USE SKIP, SKIP -1, GO TOP, GO BOTTOM and call the method valor_combos that is below:
>
>LOCAL cCBO1_Value, cCBO2_Value
>cCBO1_Value = THISFORM.cod_lote
>cCBO2_Value = THISFORM.cod_quadra
>
>WITH THISFORM
>.cboQuadra.ROWSOURCETYPE = 3
>.cboQuadra.ROWSOURCE = "SELECT nome_num, codigo FROM quadras ;
>cod_loteamento = ?cCBO1_Value ;
>ORDER BY nome_num INTO CURSOR cur_quadras"
>
>.cboLote.ROWSOURCETYPE = 3
>.cboLote.ROWSOURCE = "SELECT numero, codigo FROM lotes ;
>WHERE lotes.STATUS = stat_venda AND cod_quadra = ?cCBO2_Value ;
>ORDER BY numero INTO CURSOR cur_lotes"
>ENDWITH
>THISFORM.REFRESH
>
>If I start the form and move the pointer it works fine, but if I add a NEW record, the values of the the 2° and 3° combo disappear, but all other objects shows the right value.
>
>Could someone help me please ?
>
>TIA
>
>Peter
Peter,
IMHO you don't need to reset Rowsources in valor_combos. As I could see SQLs are same so do not reassign them but just requery and point to correct value.
Your bound column are codigo which sound to be numeric. If that's the case be sure BoundTo = .t. for combos. ie : BoundTo =.f.
Combo cursor has 1,2,3,45,67 for codigo, saying :
mycombo.Value = 2 - points 2
mycombo.Value = 5 - points 67 && Listindex
mycombo.Value = 45 - points nothing
With boundto = .t.
mycombo.Value = 2 - points 2
mycombo.Value = 5 - points nothing
mycombo.Value = 45 - points 45
Cetin