I 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.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.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.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
cCBO1_Value = This.DisplayValue()
This.Parent.cboQuadra.Requery()
In the InterActiveChange of Combo2:
DoDefault()
local cCBO2_Value
cCBO2_Value = This.DisplayValue()
This.Parent.cbo3.Requery()
And when I move the pointer with First, Next, Last, etc...
I call the forms method valor_combos
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
All works fine when I move the pointer, but if I add a new record in the table and select an option in combo1 and combo2 it returns error 31 (Invalid subscript reference) and error 107 (Operator/operand type mismatch) when I try to execute REQUERY()
Could someone help me please ?
TIA
Peter
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement