Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help - Cannot Access The Selected Table (Error 1152)
Message
De
25/07/2001 09:20:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
24/07/2001 17:57:28
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00534701
Message ID:
00534923
Vues:
18
>I have 3 combos in a form (cbo1, cbo2, cbo3)the second combo cbo2 value depends ond the value chossen in cbo1 and the same happends with cbo3.
>
>When I move the pointer in the table, I allways rebuild the cursors on which cbo2 and cbo3 are based calling a function.
>
>The function is below:
>
>* Get value of combo1 to update cbo2
>SELECT("v_clientes_")
>cbo1 = v_clientes_.loteamento
>SELECT nome_num, codigo FROM quadras WHERE DELETED() <> .T. ;
>AND cod_loteamento = cbo1 ORDER BY nome_num INTO CURSOR cur_quadras
>
>* Get value of combo2 to update cbo3
>SELECT("v_clientes_")
>cbo2 = v_clientes_.quadra
>old_area = SELECT()
>
>SELECT numero, codigo FROM lotes WHERE DELETED() <> .T. ;
>AND cod_quadra = cbo2 ORDER BY numero INTO CURSOR cur_lotes
>
>WITH THISFORM
> .cboQuadra.ROWSOURCE = "SELECT nome_num, codigo FROM quadras ;
> WHERE DELETED() <> .T. AND cod_loteamento = cbo1 ;
> order by nome_num INTO CURSOR cur_quadras"
> .cboQuadra.ROWSOURCETYPE = 3
> .cboLote.ROWSOURCE = "SELECT numero, codigo FROM lotes ;
> WHERE lotes.Status = stat_venda AND DELETED() <> .T. ;
> AND cod_quadra = cbo2 order by numero INTO CURSOR cur_lotes"
> .cboLote.ROWSOURCETYPE = 3
>ENDWITH
>SELECT("v_clientes_")
>
>*Problem is here -> when execute the next command it returns Error 1152 and *the combo disapears from the form. It seems that the Rowsource from cbo2 and *cbo3 = ""
>THISFORM.REFRESH
>
>
>* Cannot access the selected table (Error 1152)
>* You have attempted to select a table outside the 32K work area range
>* or are attempting to reference a file variable in a table that is not open.
>
>* Using VFP6.0 + SP5
>
>Does someone knows why it's happening and how to solve this ??
>
>Thanks in Advance
>
>Peter

Peter,
Instead of selecting into cursors and rebuilding them each time make SQL your rowsource. This is almost Mark's solution :
*form.init
With THISFORM
  With .cboQuadra
    .ROWSOURCETYPE = 3
    .ROWSOURCE = [SELECT nome_num, codigo ]+;
      [ FROM quadras ]+;
      [ WHERE !DELETED() ]+;
      [ AND cod_loteamento = v_clientes_.loteamento ]+;
      [  ORDER BY nome_num ]+;
      [  INTO CURSOR cur_quadras]
  Endwith
  With .cboLote
    .ROWSOURCETYPE = 3
    .ROWSOURCE = [SELECT numero, codigo ]+;
      [ FROM lotes ]+;
      [ WHERE lotes.Status = stat_venda ]+;
      [ and !DELETED() ];
      [ AND cod_quadra = v_clientes_.quadra ]+;
      [ ORDER BY numero ]+;
      [ INTO CURSOR cur_lotes ]
  Endwith
Endwith
cbo1's rowsource sounds to be v_clientes and only v_clientes effects cbo2,cbo3. So in cbo1 valid :
with this.parent.cboQuadra
  .requery()
  .Listindex = 0
endwith
with this.parent.cboLote
  .requery()
  .Listindex = 0
endwith
PS:Also as Mark said you could drop !deleted() if you set deleted on in form load or DE.beforeopentables.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform